code: def acl_middleware(callback):
      
      async def _acl_middleware_factory(app, handler):
  
          async def _middleware_handler(request):
              # Save the policy in the request
              request[GROUPS_KEY] = callback
  
              # Call the next handler in the chain
              return await handler(request)
  
          return _middleware_handler
  
      return _acl_middleware_factory
docs: Returns a aiohttp_auth.acl middleware factory for use by the aiohttp
      application object.
  
      Args:
          callback: This is a callable which takes a user_id (as returned from
              the auth.get_auth function), and expects a sequence of permitted ACL
              groups to be returned. This can be a empty tuple to represent no
              explicit permissions, or None to explicitly forbid this particular
              user_id. Note that the user_id passed may be None if no
              authenticated user exists.
  
      Returns:
          A aiohttp middleware factory.