code: def trapped_signals(cls, new_signal_handler):
      
      try:
        previous_signal_handler = cls.reset_signal_handler(new_signal_handler)
        yield
      finally:
        cls.reset_signal_handler(previous_signal_handler)
docs: A contextmanager which temporarily overrides signal handling.