def _exitOnSignal(sigName, message):
 import signal
 try:
  sigNumber = getattr(signal, sigName)
 except AttributeError:
  return
 def handler(sig, f):
  sys.exit(message)
 try:
  signal.signal(sigNumber, handler)
 except ValueError:
  pass

def _exitOnSignal ( sigName , message ) : import signal try : sigNumber = getattr ( signal , sigName ) except AttributeError : return def handler ( sig , f ) : sys . exit ( message ) try : signal . signal ( sigNumber , handler ) except ValueError : pass
handles a signal with sys .