docs: def _simulate_measurement(self, op: ops.Operation, data: _StateAndBuffer,
              indices: List[int], measurements: Dict[str, List[bool]],
              num_qubits: int) -> None:
          """Simulate an op that is a measurement in the computataional basis."""
          meas = ops.op_gate_of_type(op, ops.MeasurementGate)
          # TODO: support measurement outside computational basis.
          if meas:
              invert_mask = meas.invert_mask or num_qubits * (False,)
              # Measure updates inline.
              bits, _ = wave_function.measure_state_vector(data.state,
                                                           indices,
                                                           data.state)
              corrected = [bit ^ mask for bit, mask in
                           zip(bits, invert_mask)]
              key = protocols.measurement_key(meas)
              measurements[key].extend(corrected)