#! /usr/bin/env python3.12
import subprocess

def import_ssh_keys_to_agent(privat_key = str):
    try:
        run_add_key = subprocess.run( 
                            ["/usr/bin/ssh-add", privat_key, '>>', "/dev/null"],
                            shell=False,
                            text=False,
                            stdout=subprocess.PIPE,
                            stderr=subprocess.PIPE,
                            timeout=1,)

    except subprocess.TimeoutExpired:
        return False
                        
    print(run_add_key)
    if run_add_key.returncode == 0:
        return True
    else:
        return False


print(import_ssh_keys_to_agent(privat_key="/home/jonnybravo/.ssh/ansible-test"))