def hours(args):
    hv = get_harvest()
    if hv:
        people = get_people(hv, args.personids)
        if len(people) > 0:
            times = parse_time_inputs(args.start, args.end)
            start = times[0]
            end = times[1]
            entries_collection = [
                (person, person.entries(start = start, end = end))
                for person in people
            ]
            if len(entries_collection) > 0:
                print str.format(
                    REPORT_HEADER,
                    'Hours',
                    start.strftime('%Y-%m-%d'),
                    end.strftime('%Y-%m-%d'),
                )
                overall_hours = 0.0
                overall_billable = 0.0
                projects = hv.projects()
                for person, entries in entries_collection:
                    map = {
                        p: {
                            t: [
                                e for e in entries 
                                if e.project_id == p.id and e.task_id == t.task_id
                            ] 
                            for t in p.task_assignments()
                        }
                        for p in projects
                    }
                    total = 0.0
                    billable = 0.0
                    unbillable = 0.0
                    for proj in map:
                        for task in map[proj]:
                            for entry in map[proj][task]:
                                if task.billable:
                                    billable += entry.hours
                                    overall_billable += entry.hours
                                else:
                                    unbillable += entry.hours
                                total += entry.hours
                                overall_hours += entry.hours
                    # Divide by zero is undefined, but fudge it a little bit
                    # for easier output.
                    ratio = billable / unbillable if unbillable > 0.0 else 0.0
                    percent = total / billable if total > 0.0 else 0.0
                    print str.format(
                        HOURS_REPORT_FORMAT,
                        total = total,
                        billable = billable,
                        unbillable = unbillable,
                        ratio = ratio,
                        person = person,
                        percent = percent,
                    )
                print str.format(
                    'Overall Billable: {:.2%}',
                    overall_billable / overall_hours if overall_hours != 0.0 else 0
                )
            else:
                print 'No entries for that time period.'
        else:
            print 'No such person ID(s).'
dataset/ETHPy150Open jakebasile/reap/reap/commands/reports.py/hours/swapped operands of `/`