def parameterize_circuit(
    circuit: cirq.Circuit,
    options: XEBCharacterizationOptions,
    target_gatefamily: ops.GateFamily | None = None,
) -> cirq.Circuit:
    """Parameterize PhasedFSim-like gates in a given circuit according to
    `phased_fsim_options`.
    """
    if isinstance(target_gatefamily, ops.GateFamily):
        should_parameterize = lambda op: op in target_gatefamily or options.should_parameterize(op)
    else:
        should_parameterize = options.should_parameterize
    gate = options.get_parameterized_gate()
    return circuits.Circuit(
        circuits.Moment(
            gate.on(*op.qubits) if should_parameterize(op) else op for op in moment.operations
        )
        for moment in circuit.moments
    )
Parameterize PhasedFSim-like gates in a given circuit according to
    `phased_fsim_options`.
    
cirq-core/cirq/experiments/xeb_fitting.py