'Returns a list of the non-expired modes for a given course id
If no modes have been set in the table, returns the default mode
Arguments:
course_id (CourseKey): Search for course modes for this course.
Keyword Arguments:
include_expired (bool): If True, expired course modes will be included
in the returned JSON data. If False, these modes will be omitted.
only_selectable (bool): If True, include only modes that are shown
to users on the track selection page.  (Currently, "credit" modes
aren\'t available to users until they complete the course, so
they are hidden in track selection.)
Returns:
list of `Mode` tuples'

@classmethod
@ns_request_cached(CACHE_NAMESPACE)
def modes_for_course(cls, course_id, include_expired=False, only_selectable=True):

    now = datetime.now(pytz.UTC)
    found_course_modes = cls.objects.filter(course_id=course_id)
    if (not include_expired):
        found_course_modes = found_course_modes.filter((Q(_expiration_datetime__isnull=True) | Q(_expiration_datetime__gte=now)))
    if only_selectable:
        found_course_modes = found_course_modes.exclude(mode_slug__in=cls.CREDIT_MODES)
    modes = [mode.to_tuple() for mode in found_course_modes]
    if (not modes):
        modes = [cls.DEFAULT_MODE]
    return modes
