def _parse_grouper(grouper: str | GROUPER_T = group_settings_greedy) -> GROUPER_T:
    """Logic for turning a named grouper into one of the build-in groupers in support of the
    high-level `measure_observables` API."""
    if isinstance(grouper, str):
        try:
            grouper = _GROUPING_FUNCS[grouper.lower()]
        except KeyError:
            raise ValueError(f"Unknown grouping function {grouper}")
    return grouper
Logic for turning a named grouper into one of the build-in groupers in support of the
    high-level `measure_observables` API.
cirq-core/cirq/work/observable_measurement.py