def get_effective_user(requesting_user, target_username):
 if (target_username == requesting_user.username):
  return requesting_user
 elif (target_username == ''):
  return AnonymousUser()
 elif can_view_courses_for_username(requesting_user, target_username):
  return User.objects.get(username=target_username)
 else:
  raise PermissionDenied()

def get_effective_user ( requesting_user , target_username ) : if ( target_username == requesting_user . username ) : return requesting_user elif ( target_username == '' ) : return AnonymousUser ( ) elif can_view_courses_for_username ( requesting_user , target_username ) : return User . objects . get ( username = target_username ) else : raise PermissionDenied ( )
get the user we want to view information on behalf of .