def _get_service_user(user, service_username):
 if ((not user) or user.is_anonymous()):
  try:
   user = User.objects.get(username=service_username)
  except User.DoesNotExist:
   user = None
 return user

def _get_service_user ( user , service_username ) : if ( ( not user ) or user . is_anonymous ( ) ) : try : user = User . objects . get ( username = service_username ) except User . DoesNotExist : user = None return user
retrieve and return the catalog integration service user object if the passed user is none or anonymous .