def __init__(self, hostname, username=None, password=None, script_dir=None, envs=None, gssapi_auth=False, skip_auth=False, **kwargs):
self.hostname = hostname<EOL>self.username = username<EOL>self.password = password<EOL>self.kwargs = kwargs<EOL>self.script_dir = script_dir<EOL>self.skip_auth = skip_auth<EOL>self.gssapi_auth = gssapi_auth<EOL>if self.skip_auth:<EOL><INDENT>self.ssh_client = NoAuthSSHClient()<EOL><DEDENT>else:<EOL><INDENT>self.ssh_client = paramiko.SSHClient()<EOL><DEDENT>self.ssh_client.load_system_host_keys()<EOL>self.ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())<EOL>self.envs = {}<EOL>if envs is not None:<EOL><INDENT>self.envs = envs<EOL><DEDENT>try:<EOL><INDENT>self.ssh_client.connect(<EOL>hostname,<EOL>username=username,<EOL>password=password,<EOL>allow_agent=True,<EOL>gss_auth=gssapi_auth,<EOL>gss_kex=gssapi_auth,<EOL>)<EOL>t = self.ssh_client.get_transport()<EOL>self.sftp_client = paramiko.SFTPClient.from_transport(t)<EOL><DEDENT>except paramiko.BadHostKeyException as e:<EOL><INDENT>raise BadHostKeyException(e, self.hostname)<EOL><DEDENT>except paramiko.AuthenticationException as e:<EOL><INDENT>raise AuthException(e, self.hostname)<EOL><DEDENT>except paramiko.SSHException as e:<EOL><INDENT>raise SSHException(e, self.hostname)<EOL><DEDENT>except Exception as e:<EOL><INDENT>raise SSHException(e, self.hostname)<EOL><DEDENT>
Initialize a persistent connection to the remote system.
        We should know at this point whether ssh connectivity is possible

        Args:
            - hostname (String) : Hostname

        KWargs:
            - username (string) : Username on remote system
            - password (string) : Password for remote system
            - script_dir (string) : Full path to a script dir where
              generated scripts could be sent to.
            - envs (dict) : A dictionary of environment variables to be set when executing commands

        Raises: