code: def on_broker_exit(self):
          
          if not self.profiling:
              # In normal operation we presently kill the process because there is
              # not yet any way to cancel connect(). When profiling, threads
              # including the broker must shut down gracefully, otherwise pstats
              # won't be written.
              os.kill(os.getpid(), signal.SIGTERM)
docs: Respond to the broker thread about to exit by sending SIGTERM to
          ourself. In future this should gracefully join the pool, but TERM is
          fine for now.