code: def _postloop_hook(self) -> None:
          
  
          # After this function returns, cmdloop() releases self.terminal_lock which could make the alerter
          # thread think the prompt is on screen. Therefore this is the best place to stop the alerter thread.
          # You can also stop it via a command. See do_stop_alerts().
          self._stop_thread = True
          if self._alerter_thread.is_alive():
              self._alerter_thread.join()
docs: Stops the alerter thread