def reverse_json_ambi(
        json_ambi: dict,
        ids: set) -> dict:
    """
    Reverse a dict (values as keys, keys as list values).

    Parameters
    ----------
    json_ambi : dict
        A dict having one string value per key.
    ids : set
        sample IDs from the biom table.

    Returns
    -------
    json_ambi_rev : dict
        A dict having the input key(s) in lists
        as values to the input values as keys.
    """
    json_ambi_rev = {}
    for k, v in json_ambi.items():
        if k in ids:
            json_ambi_rev.setdefault(v, []).append(k)
    return json_ambi_rev