human
Solve the following python programming problem given the following code:
def _print_stats(self, env, stats) : 
    ' Prints statistic information using io stream.

            `env`
                ``Environment`` object.
            `stats`
                Tuple of task stats for each date.
            ' 
    def _format_time(mins) : 
        ' Generates formatted time string.
                ' 
        mins = int (mins) 
        if (mins < MINS_IN_HOUR) : 
            time_str = '0:{0:02}'.format (mins) 
else : 
            hours = (mins // MINS_IN_HOUR) 
            mins %= MINS_IN_HOUR 
            if (mins > 0) : 
                time_str = '{0}:{1:02}'.format (hours, mins) 
else : 
                time_str = '{0}'.format (hours) 
return time_str 
if (not stats) : 
        env.io.write ('No stats found.') 
        return 
for (date, tasks) in stats : 
        env.io.write ('') 
        total_mins = float (sum ((v [1] for v in tasks))) 
        env.io.write ('[{0}]'.format (date.strftime ('%Y-%m-%d'))) 
        env.io.write ('') 
        for (name, mins) in tasks : 
            time_str = _format_time (tasks) 
            line = '   {0:>5}'.format (time_str) 
            line += ' ({0:2.0f}%) - '.format (((mins * 100.0) / total_mins)) 
            if (len (name) > 55) : 
                name = (name [: 55] + '...') 
line += name 
            env.io.write (line) 
env.io.write (('_' * len (line))) 
        time_str = _format_time (total_mins) 
        env.io.write ('   {0:>5} (total)'.format (time_str)) 
        env.io.write ('') 

    
    

    Fix the buggy line: time_str = _format_time (tasks)
assistant
#Here is Python code to fix the buggy line: time_str = _format_time (tasks)
.

time_str = _format_time (mins)