def _aggregate_n_repetitions(next_chunk_repetitions: set[int]) -> int:
    """A stopping criteria can request a different number of more_repetitions for each
    measurement spec. For batching efficiency, we take the max and issue a warning in this case."""
    if len(next_chunk_repetitions) == 1:
        return list(next_chunk_repetitions)[0]

    reps = max(next_chunk_repetitions)
    warnings.warn(
        f"The stopping criteria specified a various numbers of "
        f"repetitions to perform next. To be able to submit as a single "
        f"sweep, the largest value will be used: {reps}."
    )
    return reps
A stopping criteria can request a different number of more_repetitions for each
    measurement spec. For batching efficiency, we take the max and issue a warning in this case.
cirq-core/cirq/work/observable_measurement.py