human
Complete this python program:
def _process_courses_list(courses_iter, in_process_course_actions, split_archived=False):
assistant
#Here is the Python program you requested.

    """Iterates over the list of courses to be displayed to the user, and:
    * Removes any in-process courses from the courses list. "In-process" refers to courses
    that are in the process of being generated for re-run.
    * If split_archived=True, removes any archived courses and returns them in a separate list.
    Archived courses have has_ended() == True.
    * Formats the returned courses (in both lists) to prepare them for rendering to the view.
    """
    def format_course_for_view(course):
        '\n                                Return    a    dict    of    the    data    which    the    view    requires    for    each    course\n                                '
        return {'display_name': course.display_name, 'course_key': unicode(course.location.course_key), 'url': reverse_course_url('course_handler', course.id), 'lms_link': get_lms_link_for_item(course.location), 'rerun_link': _get_rerun_link_for_item(course.id), 'org': course.display_org_with_default, 'number': course.display_number_with_default, 'run': course.location.run}
    in_process_action_course_keys = {uca.course_key for uca in in_process_course_actions}
    active_courses = []
    archived_courses = []
    for course in courses_iter:
        if (isinstance(course, ErrorDescriptor) or (course.id in in_process_action_course_keys)):
            continue
        formatted_course = format_course_for_view(course)
        if (split_archived and course.has_ended()):
            archived_courses.append(formatted_course)
        else:
            active_courses.append(formatted_course)
    return (active_courses, archived_courses)