def METHOD_NAME(course_id, enrollment_start=None, enrollment_end=None, invite_only=False, course_modes=None):
    """Append course to the courses array."""
    course_info = {
        "course_id": course_id,
        "enrollment_end": enrollment_end,
        "course_modes": [],
        "enrollment_start": enrollment_start,
        "invite_only": invite_only,
    }
    if not course_modes:
        course_info['course_modes'].append(_DEFAULT_FAKE_MODE)
    else:
        for mode in course_modes:
            new_mode = copy.deepcopy(_DEFAULT_FAKE_MODE)
            new_mode['slug'] = mode
            course_info['course_modes'].append(new_mode)
    _COURSES.append(course_info)