code: def superuser_only(view_func):
      
      def _inner(request, *args, **kwargs):
          if not request.user.is_superuser:
              raise PermissionDenied
          return view_func(request, *args, **kwargs)
      return _inner
docs: Limit a view to superuser only.