def get_valid_student_with_email(identifier):
 user = email = None
 try:
  user = get_student_from_identifier(identifier)
 except User.DoesNotExist:
  email = identifier
 else:
  email = user.email
 try:
  validate_email(email)
 except ValidationError:
  raise CCXUserValidationException('Could not find a user with name or email "{0}" '.format(identifier))
 return (email, user)

def get_valid_student_with_email ( identifier ) : user = email = None try : user = get_student_from_identifier ( identifier ) except User . DoesNotExist : email = identifier else : email = user . email try : validate_email ( email ) except ValidationError : raise CCXUserValidationException ( 'Could not find a user with name or email "{0}" ' . format ( identifier ) ) return ( email , user )
helper function to get an user email from an identifier and validate it .