old_contents: import signal
  import sys
  from threading import Event
  
  def GetInterruptEvent():
      e = Event()
  
      def signal_handler(signal, frame):
          print('You pressed Ctrl+C!')
          e.set()
  
      signal.signal(signal.SIGINT, signal_handler)
  
      return e
  
new_contents: import signal
  import sys
  from threading import Event
  
  def GetInterruptEvent():
      e = Event()
  
      def signal_handler(signal, frame):
          print('You pressed Ctrl+C!')
          e.set()
  
      signal.signal(signal.SIGINT, signal_handler)
      signal.signal(signal.SIGTERM, signal_handler)
  
      return e
  
subject: Handle sigterm as well as sigint.