code: def _exit_gracefully(signum, unused_frame):
      if signum == signal.SIGINT:
          # Ignore subsequent SIGINTs in order to prevent the exit handlers from being
          # interrupted during cleanup if CTRL+C is pressed multiple times.
          signal.signal(signal.SIGINT, signal.SIG_IGN)
          tty_write("Control-C pressed. Exiting ...\n")
      elif signum == signal.SIGQUIT:
          tty_write("SIGQUIT received. Exiting ...\n")
      sys.exit(0)
  
file_path: launchpad/launchpad/launch/signal_handling.py
imports: import atexit
  import signal
  import sys
  from typing import Callable
label_desc: Use image node_id 1 for calling a global function with example usage: _exit_gracefully(signum, unused_frame) without return types