'Retrieve course modes associated with the course.'

def get_course_modes(self, obj):

    course_modes = CourseMode.modes_for_course(obj.id, include_expired=self.include_expired, only_selectable=False)
    return [ModeSerializer(mode).data for mode in course_modes]
