code: def _kill_processes(processes):
      # TODO(lazykyama): This implementation can't stop all processes
      # which have grandchildren processes launched
      # within each child process directly forked from this script.
      # Need improvement for more safe termination.
      for p in processes:
          try:
              # NOTE: multiprocessing.Process.kill() was introduced in 3.7.
              # https://docs.python.org/3.7/library/multiprocessing.html#multiprocessing.Process.kill
              if not hasattr(p, "kill"):
                  p.terminate()
              else:
                  p.kill()
          except Exception:  # noqa: E722
              # NOTE: Ignore any exception happens during killing a process
              # because this intends to send kill signal to *all* processes.
              pass
  
file_path: espnet/espnet/distributed/pytorch_backend/launch.py
imports: import multiprocessing
  import os
  import signal
  import socket
  import time
label_desc: Use image node_id 3 for calling a global function with example usage: _kill_processes(processes) without return types