docs: def clean_exit(signum, frame=None):
      """Exit all processes attempting to finish uncommitted active work before exit.
           Can be called on an os signal or no zookeeper losing connection.
      """
      global exiting
      if exiting:
          # Since this is set up as a handler for SIGCHLD when this kills one
          # child it gets another signal, the global exiting avoids this running
          # multiple times.
          LOG.debug('Exit in progress clean_exit received additional signal %s' % signum)
          return
  
      LOG.info('Received signal %s, beginning graceful shutdown.' % signum)
      exiting = True
      wait_for_exit = False
  
      for process in processors:
          try:
              if process.is_alive():
                  # Sends sigterm which any processes after a notification is sent attempt to handle
                  process.terminate()
                  wait_for_exit = True
          except Exception:  # nosec
              # There is really nothing to do if the kill fails, so just go on.
              # The # nosec keeps bandit from reporting this as a security issue
              pass
  
      # wait for a couple seconds to give the subprocesses a chance to shut down correctly.
      if wait_for_exit:
          time.sleep(2)
  
      # Kill everything, that didn't already die
      for child in multiprocessing.active_children():
          LOG.debug('Killing pid %s' % child.pid)
          try:
              os.kill(child.pid, signal.SIGKILL)
          except Exception:  # nosec
              # There is really nothing to do if the kill fails, so just go on.
              # The # nosec keeps bandit from reporting this as a security issue
              pass
  
      if signum == signal.SIGTERM:
          sys.exit(0)
  
      sys.exit(signum)