'Update SSH connection parameters based on contents of SSH \'config\' file.'

def _use_ssh_config(self, dict_arg):

    connect_dict = dict_arg.copy()
    full_path = path.abspath(path.expanduser(self.ssh_config_file))
    if path.exists(full_path):
        ssh_config_instance = paramiko.SSHConfig()
        with io.open(full_path, u'rt', encoding=u'utf-8') as f:
            ssh_config_instance.parse(f)
            source = ssh_config_instance.lookup(self.host)
    else:
        source = {}
    if source.get(u'proxycommand'):
        proxy = paramiko.ProxyCommand(source[u'proxycommand'])
    elif source.get(u'ProxyCommand'):
        proxy = paramiko.ProxyCommand(source[u'proxycommand'])
    else:
        proxy = None
    if (connect_dict[u'port'] == 22):
        connect_dict[u'port'] = int(source.get(u'port', self.port))
    if (connect_dict[u'username'] == u''):
        connect_dict[u'username'] = source.get(u'username', self.username)
    if proxy:
        connect_dict[u'sock'] = proxy
    connect_dict[u'hostname'] = source.get(u'hostname', self.host)
    return connect_dict
