def get_host_keys(hostname, sshdir):
    """get host key"""
    hostkey = None

    try:
        host_keys = load_host_keys(os.path.join(sshdir, 'known_hosts'))
    except IOError:
        host_keys = {}

    if hostname in host_keys:
        hostkeytype = host_keys[hostname].keys()[0]
        hostkey = host_keys[hostname][hostkeytype]

    return hostkey