code: def reset_signal_handler(cls, signal_handler):
      
      assert(isinstance(signal_handler, SignalHandler))
      # NB: Modify process-global state!
      for signum, handler in signal_handler.signal_handler_mapping.items():
        signal.signal(signum, handler)
        # Retry any system calls interrupted by any of the signals we just installed handlers for
        # (instead of having them raise EINTR). siginterrupt(3) says this is the default behavior on
        # Linux and OSX.
        signal.siginterrupt(signum, False)
  
      previous_signal_handler = cls._signal_handler
      # NB: Mutate the class variables!
      cls._signal_handler = signal_handler
      return previous_signal_handler
docs: Class state:
      - Overwrites `cls._signal_handler`.
      OS state:
      - Overwrites signal handlers for SIGINT, SIGQUIT, and SIGTERM.
  
      :returns: The :class:`SignalHandler` that was previously registered, or None if this is
                the first time this method was called.