def _get_authorized_user(requesting_user, username=None, allow_staff=False):
 if (username is None):
  username = requesting_user.username
 try:
  existing_user = User.objects.get(username=username)
 except ObjectDoesNotExist:
  raise UserNotFound()
 _check_authorized(requesting_user, username, allow_staff)
 return existing_user

def _get_authorized_user ( requesting_user , username = None , allow_staff = False ) : if ( username is None ) : username = requesting_user . username try : existing_user = User . objects . get ( username = username ) except ObjectDoesNotExist : raise UserNotFound ( ) _check_authorized ( requesting_user , username , allow_staff ) return existing_user
helper method to return the authorized user for a given username .