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