def _transform_moment_with_circuit_ops_to_moment_with_single_op(
    moment: circuits.Moment,
) -> circuits.Moment:
    """Merges all circuit operations in a moment into a single circuit operation.

    Args:
        moment: A cirq moment composed of single and two qubit operations.

    Returns:
        A Moment with at most one CircuitOperation.
    """
    circuit_ops = [
        op.mapped_circuit() for op in moment if isinstance(op, circuits.CircuitOperation)
    ]
    not_circuit_ops = [op for op in moment if not isinstance(op, circuits.CircuitOperation)]
    all_subcircuits = circuit_ops
    if not_circuit_ops:
        all_subcircuits.append(circuits.Circuit(circuits.Moment(not_circuit_ops)))
    return circuits.Moment(circuits.CircuitOperation(circuits.FrozenCircuit.zip(*all_subcircuits)))
Merges all circuit operations in a moment into a single circuit operation.

    Args:
        moment: A cirq moment composed of single and two qubit operations.

    Returns:
        A Moment with at most one CircuitOperation.
    
cirq-core/cirq/experiments/benchmarking/parallel_xeb.py