code: def future_set_result_unless_cancelled(future, value):
      """Set the given ``value`` as the `Future`'s result, if not cancelled.
  
      Avoids asyncio.InvalidStateError when calling set_result() on
      a cancelled `asyncio.Future`.
  
      .. versionadded:: 5.0
      """
      if not future.cancelled():
          future.set_result(value)
  
file_path: ipyparallel/ipyparallel/client/futures.py
imports: import sys
  from concurrent.futures import Future
  from threading import Event
  from tornado.log import app_log
label_desc: Use image node_id 1 for calling a global function with example usage: future_set_result_unless_cancelled(future, value) without return types