code: def signal_terminate(on_terminate):
      
      for i in [signal.SIGINT, signal.SIGQUIT, signal.SIGUSR1, signal.SIGUSR2, signal.SIGTERM]:
          signal.signal(i, on_terminate)
docs: a common case program termination signal