<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def on_broker_exit(self):
 """ 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. """

        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)