def filter_dictionary_by_resolution(raw_data, threshold=False):
    """Filter SidechainNet data by removing poor-resolution training entries.

    Args:
        raw_data (dict): SidechainNet dictionary.
        threshold (float, bool): Entries with resolution values greater than this value 
            are discarded. Test set entries have no measured resolution and are not
            excluded. Default is 3 Angstroms. If False, nothing is filtered.

    Returns:
        Filtered dictionary.
    """
    if not threshold:
        return raw_data
    if isinstance(threshold, bool) and threshold is True:
        threshold = 3
    new_data = {
        "seq": [],
        "ang": [],
        "ids": [],
        "evo": [],
        "msk": [],
        "crd": [],
        "sec": [],
        "res": []
    }
    train = raw_data["train"]
    n_filtered_entries = 0
    total_entires = 0.
    for seq, ang, crd, msk, evo, _id, res, sec in zip(train['seq'], train['ang'],
                                                      train['crd'], train['msk'],
                                                      train['evo'], train['ids'],
                                                      train['res'], train['sec']):
        total_entires += 1
        if not res or res > threshold:
            n_filtered_entries += 1
            continue
        else:
            new_data["seq"].append(seq)
            new_data["ang"].append(ang)
            new_data["ids"].append(_id)
            new_data["evo"].append(evo)
            new_data["msk"].append(msk)
            new_data["crd"].append(crd)
            new_data["sec"].append(sec)
            new_data["res"].append(res)
    if n_filtered_entries:
        print(f"{n_filtered_entries} ({n_filtered_entries/total_entires:.1%})"
              " training set entries were excluded based on resolution.")
    raw_data["train"] = new_data
    return raw_data