def _validate_depth(
    circuits: Sequence[cirq.AbstractCircuit], max_moments: int = MAX_MOMENTS
) -> None:
    """Validate that the depth of the circuit is not too long (too many moments)."""
    for circuit in circuits:
        if len(circuit) > max_moments:
            raise RuntimeError(f'Provided circuit exceeds the limit of {max_moments} moments.')
Validate that the depth of the circuit is not too long (too many moments).
cirq-google/cirq_google/engine/engine_validator.py