def METHOD_NAME(self, command: str = "logout") -> None:
    """Gracefully exit the SSH session."""
    self._base_mode()
    if self.session_log:
        self.session_log.fin = True
    # Always try to send final 'logout'
    self.write_channel(command + self.RETURN)
    output = ""
    for _ in range(30):
        time.sleep(0.1)
        output += self.read_channel()
        if "Do you wish to end" in output:
            self.write_channel("yes" + self.RETURN)
            break