'Returns an ssh connection to the specified host.'

def _get_ssh_connection(self, sleep=1.5, backoff=1):

    bsleep = sleep
    ssh = paramiko.SSHClient()
    ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
    _start_time = time.time()
    if (self.pkey is not None):
        LOG.info("Creating    ssh    connection    to    '%s:%d'    as    '%s'    with    public    key    authentication", self.host, self.port, self.username)
    else:
        LOG.info("Creating    ssh    connection    to    '%s:%d'    as    '%s'    with    password    %s", self.host, self.port, self.username, str(self.password))
    attempts = 0
    while True:
        if (self.proxy_client is not None):
            proxy_chan = self._get_proxy_channel()
        else:
            proxy_chan = None
        try:
            ssh.connect(self.host, port=self.port, username=self.username, password=self.password, look_for_keys=self.look_for_keys, key_filename=self.key_filename, timeout=self.channel_timeout, pkey=self.pkey, sock=proxy_chan)
            LOG.info('ssh    connection    to    %s@%s    successfully    created', self.username, self.host)
            return ssh
        except (EOFError, socket.error, socket.timeout, paramiko.SSHException) as e:
            ssh.close()
            if self._is_timed_out(_start_time):
                LOG.exception('Failed    to    establish    authenticated    ssh    connection    to    %s@%s    after    %d    attempts', self.username, self.host, attempts)
                raise exceptions.SSHTimeout(host=self.host, user=self.username, password=self.password)
            bsleep += backoff
            attempts += 1
            LOG.warning('Failed    to    establish    authenticated    ssh    connection    to    %s@%s    (%s).    Number    attempts:    %s.    Retry    after    %d    seconds.', self.username, self.host, e, attempts, bsleep)
            time.sleep(bsleep)
