def get_student(username_or_email, course_key):
 try:
  student = get_user_by_username_or_email(username_or_email)
 except ObjectDoesNotExist:
  raise ValueError(_('{user} does not exist in the LMS. Please check your spelling and retry.').format(user=username_or_email))
 if (not CourseEnrollment.is_enrolled(student, course_key)):
  raise ValueError(_('{user} is not enrolled in this course. Please check your spelling and retry.').format(user=username_or_email))
 return student

def get_student ( username_or_email , course_key ) : try : student = get_user_by_username_or_email ( username_or_email ) except ObjectDoesNotExist : raise ValueError ( _ ( '{user} does not exist in the LMS. Please check your spelling and retry.' ) . format ( user = username_or_email ) ) if ( not CourseEnrollment . is_enrolled ( student , course_key ) ) : raise ValueError ( _ ( '{user} is not enrolled in this course. Please check your spelling and retry.' ) . format ( user = username_or_email ) ) return student
retrieve and return user object from db .