code: def backtrace_on_usr1 ():
      
      import signal
      try:
          signal.signal (signal.SIGUSR1, _print_backtrace_signal_handler)
      except Exception as e:
          warn ('failed to set up Python backtraces on SIGUSR1: %s', e)
docs: Install a signal handler such that this program prints a Python traceback
      upon receipt of SIGUSR1. This could be useful for checking that
      long-running programs are behaving properly, or for discovering where an
      infinite loop is occurring.
  
      Note, however, that the Python interpreter does not invoke Python signal
      handlers exactly when the process is signaled. For instance, a signal
      delivered in the midst of a time.sleep() call will only be seen by Python
      code after that call completes. This means that this feature may not be as
      helpful as one might like for debugging certain kinds of problems.