code: def setup(self, middleware):
          
          if not isinstance(middleware, BaseMiddleware):
              raise TypeError(f"`middleware` must be an instance of BaseMiddleware, not {type(middleware)}")
          if middleware.is_configured():
              raise ValueError('That middleware is already used!')
  
          self.applications.append(middleware)
          middleware.setup(self)
          log.debug(f"Loaded middleware '{middleware.__class__.__name__}'")
          return middleware
docs: Setup middleware
  
          :param middleware:
          :return: