code: def _add_hook_if_enabled():
      # An MPI runtime is expected to kill all of its child processes
      # if one of them exits abnormally or without calling `MPI_Finalize()`.
      # However, when a Python program run on `mpi4py`, the MPI runtime
      # often fails to detect a process failure, and the rest of the processes
      # hang infinitely.
      # It is problematic especially when you run ChainerMN programs on a cloud
      # environment, on which you are charged on time basis.
      # See https://github.com/chainer/chainermn/issues/236 for more discussion.
      #
      # To activate this handler, set CHAINERMN_FORCE_ABORT_ON_EXCEPTION
      # to a non-empty value.
      # Note that you need to pass an argument to mpiexec (-x for Open MPI)
      # to activate the handler in all processes.
      var = os.environ.get("CHAINERMN_FORCE_ABORT_ON_EXCEPTION")
      if var is not None and len(var) > 0:
          add_hook()
  
imports: import os
  import sys
  import warnings
label_desc: Use image node_id 2 for calling a global function with example usage: _add_hook_if_enabled() without return types