docs: def _parity_interaction(q0: ops.Qid,
                          q1: ops.Qid,
                          rads: float,
                          atol: float,
                          gate: Optional[ops.Gate] = None):
      """Yields a ZZ interaction framed by the given operation."""
      if abs(rads) < atol:
          return
  
      h = rads * -2 / np.pi
      if gate is not None:
          g = cast(ops.Gate, gate)
          yield g.on(q0), g.on(q1)
  
      # If rads is ±pi/4 radians within tolerance, single full-CZ suffices.
      if _is_trivial_angle(rads, atol):
          yield ops.CZ.on(q0, q1)
      else:
          yield ops.CZ(q0, q1) ** (-2 * h)
  
      yield ops.Z(q0)**h
      yield ops.Z(q1)**h
      if gate is not None:
          g = protocols.inverse(gate)
          yield g.on(q0), g.on(q1)