code: def _group_tasks_by_jobid(tasks):
    
    ret = collections.defaultdict(list)
    for t in tasks:
      ret[t.get_field('job-id')].append(t)
    return ret
docs: A defaultdict with, for each job, a list of its tasks.