code: def _async_future_callback(future, event, callback, error_callback):
      assert future.done()  # noqa: S101
      try:
          exception = future.exception()
      except _futures.CancelledError:
          exception = TimeoutError()
      try:
          if exception is not None:
              if error_callback is not None:
                  error_callback(exception)
          else:
              if callback is not None:
                  callback(future.result())
      finally:
          event.set()
  
imports: from os import cpu_count
  import functools
  import operator
  import threading
  import warnings
  import weakref
  from ..None import futures
label_desc: Use image node_id 2 for calling a global function with example usage: _async_future_callback(future, event, callback, error_callback) without return types