code: def _compose_cancel(context, new_future):
      old_future = context.pop()
      try:
          if new_future.cancelled():
              new_future.set_running_or_notify_cancel()
              old_future.cancel()
      finally:
          new_future = None
          old_future = None
  
file_path: mpi4py/src/mpi4py/futures/util.py
imports: import collections
  import functools
  import threading
  from .None import _base
label_desc: Use image node_id 3 for calling a global function with example usage: _compose_cancel(context, new_future) without return types