code: def _alerter_thread_func(self) -> None:
          
  
          self._alert_count = 0
          self._next_alert_time = 0
  
          while not self._stop_thread:
              # Always acquire terminal_lock before printing alerts or updating the prompt
              # To keep the app responsive, do not block on this call
              if self.terminal_lock.acquire(blocking=False):
  
                  # Get any alerts that need to be printed
                  alert_str = self._generate_alert_str()
  
                  # Generate a new prompt
                  new_prompt = self._generate_colored_prompt()
  
                  # Check if we have alerts to print
                  if alert_str:
                      # new_prompt is an optional parameter to async_alert()
                      self.async_alert(alert_str, new_prompt)
                      new_title = "Alerts Printed: {}".format(self._alert_count)
                      self.set_window_title(new_title)
  
                  # No alerts needed to be printed, check if the prompt changed
                  elif new_prompt != self.prompt:
                      self.async_update_prompt(new_prompt)
  
                  # Don't forget to release the lock
                  self.terminal_lock.release()
  
              time.sleep(0.5)
docs: Prints alerts and updates the prompt any time the prompt is showing