import json


def fastani_validate(GCFheaders, ground_truth):
    """Extend ground truth using fastANI filtered fastaheaders
    parameters
    ----------
    GCFheaders
    ground_truth
    returns
    ----------
    ret = {fastaheader : read_IDs with fastani filtering}
    """

    with open(GCFheaders, "r") as j:
        GCFfasta = json.load(j) # fastani headers

    ret = {}
    for GCFheaderkey in GCFfasta.keys():
        ret[GCFheaderkey] = []
        for sim_header in GCFfasta[GCFheaderkey]:
            for read_ID in ground_truth[sim_header]:
                ret[GCFheaderkey].append(read_ID)
    return(ret)