def get_ssh_client(<EOL>ip_addr,<EOL>ssh_key=None,<EOL>host_name=None,<EOL>ssh_tries=None,<EOL>propagate_fail=True,<EOL>username='<STR_LIT:root>',<EOL>password='<STR_LIT>',<EOL>):
host_name = host_name or ip_addr<EOL>with LogTask(<EOL>'<STR_LIT>' % host_name,<EOL>level='<STR_LIT>',<EOL>propagate_fail=propagate_fail,<EOL>):<EOL><INDENT>ssh_timeout = int(config.get('<STR_LIT>'))<EOL>if ssh_tries is None:<EOL><INDENT>ssh_tries = int(config.get('<STR_LIT>', <NUM_LIT:10>))<EOL><DEDENT>start_time = time.time()<EOL>client = paramiko.SSHClient()<EOL>client.set_missing_host_key_policy(paramiko.AutoAddPolicy(), )<EOL>while ssh_tries > <NUM_LIT:0>:<EOL><INDENT>try:<EOL><INDENT>client.connect(<EOL>ip_addr,<EOL>username=username,<EOL>password=password,<EOL>key_filename=ssh_key,<EOL>timeout=ssh_timeout,<EOL>)<EOL>break<EOL><DEDENT>except (socket.error, socket.timeout) as err:<EOL><INDENT>LOGGER.debug(<EOL>'<STR_LIT>',<EOL>host_name,<EOL>err,<EOL>)<EOL><DEDENT>except paramiko.ssh_exception.SSHException as err:<EOL><INDENT>LOGGER.debug(<EOL>'<STR_LIT>',<EOL>host_name,<EOL>err,<EOL>)<EOL><DEDENT>except EOFError as err:<EOL><INDENT>LOGGER.debug('<STR_LIT>', host_name, err)<EOL><DEDENT>ssh_tries -= <NUM_LIT:1><EOL>LOGGER.debug(<EOL>'<STR_LIT>',<EOL>ssh_tries,<EOL>host_name,<EOL>)<EOL>time.sleep(<NUM_LIT:1>)<EOL><DEDENT>else:<EOL><INDENT>end_time = time.time()<EOL>raise LagoSSHTimeoutException(<EOL>'<STR_LIT>' %<EOL>(end_time - start_time, host_name)<EOL>)<EOL><DEDENT><DEDENT>return client<EOL>
Get a connected SSH client

Args:
    ip_addr(str): IP address of the endpoint
    ssh_key(str or list of str): Path to a file which
        contains the private key
    hotname(str): The hostname of the endpoint
    ssh_tries(int): The number of attempts to connect to the endpoint
    propagate_fail(bool): If set to true, this event will be in the log
        and fail the outer stage. Otherwise, it will be discarded.
    username(str): The username to authenticate with
    password(str): Used for password authentication
        or for private key decryption

Raises:
    :exc:`~LagoSSHTimeoutException`: If the client failed to connect after
        "ssh_tries"