code: def _result_or_cancel(fut, timeout=None):
      try:
          try:
              return fut.result(timeout)
          finally:
              fut.cancel()
      finally:
          # Break a reference cycle with the exception in self._exception
          del fut
  
imports: import collections
  import logging
  import threading
  import time
  import types
label_desc: Use image node_id 5 for calling a global function with example usage: _result_or_cancel(fut, timeout) and returns: fut