import paramiko
import os
from io import StringIO

SSH_KEY = """-----<KEY>
"""


def get_conn(ip_addr, user="ubuntu"):
    key = paramiko.RSAKey.from_private_key(StringIO(SSH_KEY))
    client = paramiko.SSHClient()
    client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
    client.connect(
        hostname=ip_addr,
        username=user,
        pkey=key,
        timeout=3600,
        auth_timeout=3600,
        allow_agent=False,
        look_for_keys=False,
    )
    return client


def disconn(ssh_client: paramiko.SSHClient):
    ssh_client.close()
