def computeSupportedUnits(all_units, sanctioned_units):
    """Given the set of all possible ICU unit identifiers and the set of sanctioned unit
    identifiers, compute the set of effectively supported ICU unit identifiers.
    """

    def find_match(unit):
        unit_match = [
            (unit_type, unit_name)
            for (unit_type, unit_name) in all_units
            if unit_name == unit
        ]
        if unit_match:
            assert len(unit_match) == 1
            return unit_match[0]
        return None

    def compound_unit_identifiers():
        for numerator in sanctioned_units:
            for denominator in sanctioned_units:
                yield "{}-per-{}".format(numerator, denominator)

    supported_simple_units = {find_match(unit) for unit in sanctioned_units}
    assert None not in supported_simple_units

    supported_compound_units = {
        unit_match
        for unit_match in (find_match(unit) for unit in compound_unit_identifiers())
        if unit_match
    }

    return supported_simple_units | supported_compound_units