'Split a list of jobs into at most num groups, as evenly as possible'

def split_jobs(self, jobs, num):

    groups = [[] for i in range(num)]
    jobs = list(jobs)
    while jobs:
        for gr in groups:
            try:
                job = jobs.pop()
            except IndexError:
                break
            gr.append(job)
    return [g for g in groups if g]
