code: def allow_staff_or_superuser(func):
      
      is_object_permission = "has_object" in func.__name__
  
      @wraps(func)
      def func_wrapper(*args, **kwargs):
          request = args[0]
          # use second parameter if object permission
          if is_object_permission:
              request = args[1]
  
          if request.user.is_staff or request.user.is_superuser:
              return True
  
          return func(*args, **kwargs)
  
      return func_wrapper
docs: This decorator is used to abstract common is_staff and is_superuser functionality
      out of permission checks. It determines which parameter is the request based on name.