code: def middleware(self, *args, **kwargs):
          
          kwargs.setdefault('priority', 5)
          kwargs.setdefault('relative', None)
          kwargs.setdefault('attach_to', None)
          kwargs.setdefault('with_context', False)
          if len(args) == 1 and callable(args[0]):
              middle_f = args[0]
              self._middlewares.append(
                  FutureMiddleware(middle_f, args=tuple(), kwargs=kwargs))
              return middle_f
  
          def wrapper(middleware_f):
              self._middlewares.append(
                  FutureMiddleware(middleware_f, args=args, kwargs=kwargs))
              return middleware_f
          return wrapper
docs: Decorate and register middleware
          :param args: captures all of the positional arguments passed in
          :type args: tuple(Any)
          :param kwargs: captures the keyword arguments passed in
          :type kwargs: dict(Any)
          :return: The middleware function to use as the decorator
          :rtype: fn