from typing import Any


def gateway_command_result(result: Any, timed_out: bool = False) -> str:
    if timed_out:
        return gettext("Gateway command timed out.")
    elif result == "gateway request failed at core":
        return gettext("Gateway request failed at core.")
    elif result == "login failed":
        return gettext("Login failed.")
    elif result == "login successful":
        return gettext("Logged in.")
    elif result == "logout failed":
        return gettext("Logout failed.")
    elif result == "logout successful":
        return gettext("Logged out.")
    return str(result)


def password_change_command_result(result: Any, timed_out: bool = False) -> str:
    if timed_out:
        return gettext("Gateway command timed out.")
    elif result == "password change failed":
        return gettext("Failed to change account password.")
    elif result == "password change successful":
        return gettext("Successfully changed account password.")
    return str(result)
