def find_dupes(facts):
    """Find hosts with duplicate SSH host keys from PuppetDB output"""
    hosts_by_key = {}
    for fact in facts:
        hosts_by_key.setdefault(
            fact['value'],
            set(),
        ).add(fact['certname'])

    return {
        k: v
        for k, v in hosts_by_key.items()
        if len(v) > 1
    }