'Returns a mapping of path -> paramiko.PKey entries available for
this user. Keys are found in the default locations (~/.ssh/id_[d|r]sa)
as well as any IdentityFile entries in the standard ssh config files.'

@staticmethod
def get_user_keys(hostname):

    raw_identity_files = ['~/.ssh/id_dsa', '~/.ssh/id_rsa']
    for config_path in ('/etc/ssh/ssh_config', '~/.ssh/config'):
        config_path = os.path.expanduser(config_path)
        if (not os.path.exists(config_path)):
            continue
        host_pattern = '*'
        config_lines = open(config_path).readlines()
        for line in config_lines:
            (key, value) = ParamikoHost._parse_config_line(line)
            if (key == 'Host'):
                host_pattern = value
            elif ((key == 'IdentityFile') and fnmatch.fnmatch(hostname, host_pattern)):
                raw_identity_files.append(value)
    identity_files = []
    UNSUPPORTED_ESCAPES = ['%d', '%u', '%l', '%h', '%r']
    for path in raw_identity_files:
        if sum(((escape in path) for escape in UNSUPPORTED_ESCAPES)):
            continue
        path = os.path.expanduser(path)
        if os.path.exists(path):
            identity_files.append(path)
    user_keys = {}
    for path in identity_files:
        key = ParamikoHost._load_key(path)
        if key:
            user_keys[path] = key
    use_sshagent = settings.get_value('AUTOSERV', 'use_sshagent_with_paramiko', type=bool)
    if use_sshagent:
        ssh_agent = paramiko.Agent()
        for (i, key) in enumerate(ssh_agent.get_keys()):
            user_keys[('agent-key-%d' % i)] = key
    return user_keys
