'Check if course qualifies as in progress as part of the program.
A course is considered to be in progress if a user is enrolled in a run
of the correct mode or a run of the correct mode is still available for enrollment.
Arguments:
now (datetime): datetime for now
course (dict): Containing nested course runs.
Returns:
bool, indicating whether the course is in progress.'

def _is_course_in_progress(self, now, course):

    enrolled_runs = [run for run in course['course_runs'] if (run['key'] in self.course_run_ids)]
    runs_with_required_mode = [run for run in enrolled_runs if (run['type'] == self.enrolled_run_modes[run['key']])]
    if runs_with_required_mode:
        not_failed_runs = [run for run in runs_with_required_mode if (run not in self.failed_course_runs)]
        if not_failed_runs:
            return True
    upgrade_deadlines = []
    for run in enrolled_runs:
        for seat in run['seats']:
            if ((seat['type'] == run['type']) and (run['type'] != self.enrolled_run_modes[run['key']])):
                upgrade_deadlines.append(seat['upgrade_deadline'])
    return any((((not deadline) or (deadline and (parse(deadline) > now))) for deadline in upgrade_deadlines))
