code: def clean_process_tree(*signal_handler_args):
      
      parent = psutil.Process()
      procs = parent.children(recursive=True)
      if procs:
          print(f"[ZProc] Cleaning up {parent.name()!r} ({os.getpid()})...")
  
      for p in procs:
          with suppress(psutil.NoSuchProcess):
              p.terminate()
      _, alive = psutil.wait_procs(procs, timeout=0.5)  # 0.5 seems to work
      for p in alive:
          with suppress(psutil.NoSuchProcess):
              p.kill()
  
      try:
          signum = signal_handler_args[0]
      except IndexError:
          pass
      else:
          os._exit(signum)
docs: Stop all Processes in the current Process tree, recursively.