'Flatten programs into a set of course runs.'

def _flatten(self, programs):

    course_runs = set()
    for program in programs:
        for course in program['courses']:
            for course_run in course['course_runs']:
                key = CourseKey.from_string(course_run['key'])
                course_runs.add(CourseRun(key, course_run['type']))
    return course_runs
