def get_course(offering): """Get a course with the given name. If the user is not enrolled, flash a warning message. """ course = Course.by_name(offering) if not course: abort(404) check_enrollment(course) return course