code: def run(self) -> None:
          
          while self._running:
              try:
                  future, function = self._tx.get(timeout=0.1)
              except Empty:
                  continue
  
              try:
                  LOG.debug("executing %s", function)
                  result = function()
                  LOG.debug("returning %s", result)
                  self._loop.call_soon_threadsafe(future.set_result, result)
              except BaseException as e:
                  LOG.exception("returning exception %s", e)
                  self._loop.call_soon_threadsafe(future.set_exception, e)
docs: Execute function calls on a separate thread.