code: def _single_cross_over_cz(moment_index: int,
                            op: ops.Operation,
                            qubit_with_w: ops.Qid,
                            state: _OptimizerState) -> None:
      
      t = cast(float, _try_get_known_cz_half_turns(op))
      other_qubit = op.qubits[0] if qubit_with_w == op.qubits[1] else op.qubits[1]
      negated_cz = ops.CZ(*op.qubits)**-t
      kickback = ops.Z(other_qubit)**t
  
      state.deletions.append((moment_index, op))
      state.inline_intos.append((moment_index, negated_cz))
      state.insertions.append((moment_index, kickback))
docs: Crosses exactly one W flip over a partial CZ.
  
      [Where W(a) is shorthand for PhasedX(phase_exponent=a).]
  
      Uses the following identity:
  
          ──────────@─────
                    │
          ───W(a)───@^t───
  
  
          ≡ ───@──────O──────@────────────────────
               |      |      │                      (split into on/off cases)
            ───W(a)───W(a)───@^t──────────────────
  
          ≡ ───@─────────────@─────────────O──────
               |             │             |        (off doesn't interact with on)
            ───W(a)──────────@^t───────────W(a)───
  
          ≡ ───────────Z^t───@──────@──────O──────
                             │      |      |        (crossing causes kickback)
            ─────────────────@^-t───W(a)───W(a)───  (X Z^t X Z^-t = exp(pi t) I)
  
          ≡ ───────────Z^t───@────────────────────
                             │                      (merge on/off cases)
            ─────────────────@^-t───W(a)──────────
  
          ≡ ───Z^t───@──────────────
                     │
            ─────────@^-t───W(a)────