from typing import Dict

from netmiko import (ConnectHandler, NetmikoBaseException,
                     NetMikoTimeoutException)
from netmiko.cisco import CiscoFtdSSH


def prepare_cisco_ftd_session(connect_data: Dict):
    try:
        ftd_session = CiscoFtdSSH(**connect_data)
        return ftd_session
    except NetMikoTimeoutException:
        raise ValueError()


if __name__ == "__main__":
    request_data = {
        "host": "172.31.142.223",
        "username": "admin",
        "password": "T15462&93016n.",
        "port": 22,
    }
    session = prepare_cisco_ftd_session(request_data)
    session.serial_login()
    result = session.send_command("show version")
    print(result)
