def _parity_interaction(
    q0: cirq.Qid, q1: cirq.Qid, rads: float, atol: float, gate: ops.Gate | None = None
):
    """Yields an XX interaction framed by the given operation."""

    if abs(rads) < atol:
        return

    if gate is not None:
        yield gate.on(q0), gate.on(q1)

    yield ops.ms(-1 * rads).on(q0, q1)

    if gate is not None:
        g = protocols.inverse(gate)
        yield g.on(q0), g.on(q1)
Yields an XX interaction framed by the given operation.
cirq-core/cirq/transformers/analytical_decompositions/two_qubit_to_ms.py