code: def middleware(self, *args, **kwargs):
          
          kwargs.setdefault('priority', 5)
          kwargs.setdefault('relative', None)
          kwargs.setdefault('attach_to', None)
          kwargs['with_context'] = True  # This is the whole point of this plugin
          plugin = self.plugin
          reg = self.reg
  
          if len(args) == 1 and callable(args[0]):
              middle_f = args[0]
              return plugin._add_new_middleware(reg, middle_f, **kwargs)
  
          def wrapper(middle_f):
              nonlocal plugin, reg
              nonlocal args, kwargs
              return plugin._add_new_middleware(reg, middle_f, *args, **kwargs)
          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