code: def _simulate_mixture(self, op: ops.Operation, data: _StateAndBuffer,
              indices: List[int]) -> None:
          
          probs, unitaries = zip(*protocols.mixture(op))
          # We work around numpy barfing on choosing from a list of
          # numpy arrays (which is not `one-dimensional`) by selecting
          # the index of the unitary.
          index = np.random.choice(range(len(unitaries)), p=probs)
          shape = (2,) * (2 * len(indices))
          unitary = unitaries[index].astype(self._dtype).reshape(shape)
          result = linalg.targeted_left_multiply(unitary, data.state, indices,
                                                 out=data.buffer)
          data.buffer = data.state
          data.state = result
docs: Simulate an op that is a mixtures of unitaries.