def kraus_noise_model_to_cirq(
    kraus_noise_model: dict[tuple[QubitDesignator, ...], list[NDArray[np.complex128]]],
    defined_gates: dict[QubitDesignator, Gate] | None = None,
) -> InsertionNoiseModel:  # pragma: no cover
    """Construct a Cirq noise model from the provided Kraus operators.

    Args:
        kraus_noise_model: A dictionary where the keys are tuples of Quil gate names and qubit
        indices and the values are the Kraus representation of the noise channel.
        defined_gates: A dictionary mapping Quil gates to Cirq gates.
    Returns:
        A Cirq InsertionNoiseModel which applies the Kraus operators to the specified gates.
    Raises:
        Exception: If a QubitDesignator identifier is not an integer.
    """
    if defined_gates is None:
        # SUPPORTED_GATES values are all safe to use as `Gate`
        defined_gates = SUPPORTED_GATES  # type: ignore
    ops_added = {}
    for key, kraus_ops in kraus_noise_model.items():
        gate_name = key[0]

        try:
            qubit_indices = [int(q) for q in key[1:]]  # type: ignore
        except ValueError as e:
            raise Exception("Qubit identifier must be integers") from e
        qubits = [LineQubit(q) for q in qubit_indices]

        # defined_gates is not None by this point
        gate: type[Gate] = defined_gates[gate_name]  # type: ignore
        target_op = OpIdentifier(gate, *qubits)

        insert_op = KrausChannel(kraus_ops, validate=True).on(*qubits)
        ops_added[target_op] = insert_op

    noise_model = InsertionNoiseModel(ops_added=ops_added, require_physical_tag=False)

    return noise_model
Construct a Cirq noise model from the provided Kraus operators.

    Args:
        kraus_noise_model: A dictionary where the keys are tuples of Quil gate names and qubit
        indices and the values are the Kraus representation of the noise channel.
        defined_gates: A dictionary mapping Quil gates to Cirq gates.
    Returns:
        A Cirq InsertionNoiseModel which applies the Kraus operators to the specified gates.
    Raises:
        Exception: If a QubitDesignator identifier is not an integer.
    
cirq-rigetti/cirq_rigetti/quil_input.py