code: def _chain_resolve_success(new_future, result, on_success=None):
      try:
          if on_success:
              result = on_success(result)
          if isinstance(result, Future):
              _chain_resolve_future(new_future, result)
          else:
              new_future.set_result(result)
      finally:
          del new_future, result, on_success
  
file_path: mpi4py/src/mpi4py/futures/aplus.py
imports: import functools
  import threading
  import weakref
  from ._base import Future
label_desc: Use image node_id 6 for calling a global function with example usage: _chain_resolve_success(new_future, result, on_success) without return types