docs: def cleanup(self):
          """Gracefully exit the SSH session."""
          try:
              self.exit_config_mode()
          except Exception:
              # Always try to send 'exit' regardless of whether exit_config_mode works or not.
              pass
          self._session_log_fin = True
          self.write_channel("exit" + self.RETURN)