code: def run_on_executor(*args, **kwargs):
      
      def run_on_executor_decorator(fn):
          executor = kwargs.get("executor", "executor")
  
          @functools.wraps(fn)
          def wrapper(self, *args, **kwargs):
              callback = kwargs.pop("callback", None)
              future = getattr(self, executor).submit(fn, self, *args, **kwargs)
              if callback:
                  from .ioloop import IOLoop
                  IOLoop.current().add_future(
                      future, lambda future: callback(future.result()))
              return future
          return wrapper
      if args and kwargs:
          raise ValueError("cannot combine positional and keyword args")
      if len(args) == 1:
          return run_on_executor_decorator(args[0])
      elif len(args) != 0:
          raise ValueError("expected 1 argument, got %d", len(args))
      return run_on_executor_decorator
docs: Decorator to run a synchronous method asynchronously on an executor.
  
      The decorated method may be called with a ``callback`` keyword
      argument and returns a future.
  
      The executor to be used is determined by the ``executor``
      attributes of ``self``. To use a different attribute name, pass a
      keyword argument to the decorator::
  
          @run_on_executor(executor='_thread_pool')
          def foo(self):
              pass
  
      .. versionchanged:: 4.2
         Added keyword arguments to use alternative attributes.
  
      .. versionchanged:: 5.0
         Always uses the current IOLoop instead of ``self.io_loop``.