def _filter_unique_identities(uidentities, matcher):
    """Filter a set of unique identities.

    This function will use the `matcher` to generate a list
    of `FilteredIdentity` objects. It will return a tuple
    with the list of filtered objects, the unique identities
    not filtered and a table mapping uuids with unique
    identities.
    """
    filtered = []
    no_filtered = []
    uuids = {}

    for uidentity in uidentities:
        n = len(filtered)
        filtered += matcher.filter(uidentity)

        if len(filtered) > n:
            uuids[uidentity.uuid] = uidentity
        else:
            no_filtered.append([uidentity])

    return filtered, no_filtered, uuids