code: def signal_handler (signal_number):
      
      # create the 'real' decorator which takes only a function as an argument
      def newfunc (function):
          """Register function as signal handler."""
          # note: actually the kill(2) function uses the signal number of 0
          # for a special case, but for signal(2) only positive integers
          # are allowed
          is_valid_signal = 0 < signal_number < signal.NSIG
          if is_valid_signal and os.name == 'posix':
              signal.signal(signal_number, function)
          return function
      return newfunc
docs: From http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/410666
  
      A decorator to set the specified function as handler for a signal.
      This function is the 'outer' decorator, called with only the
      (non-function) arguments.
      If signal_number is not a valid signal (for example signal.SIGN),
      no handler is set.