def _Apply(self, meta_data):
    """Applies the current txn on the given entity group.

    This function blindly performs the operations contained in the current txn.
    The calling function must acquire the entity group write lock and ensure
    transactions are applied in order.
    """

    self._apply_lock.acquire()
    try:

      assert self._state == self.COMMITTED
      for tracker in self._entity_groups.values():
        if tracker._meta_data is meta_data:
          break
      else:
        assert False
      assert tracker._read_pos != tracker.APPLIED


      for entity, insert in tracker._put.itervalues():
        key = datastore_types.ReferenceToKeyValue(entity.key())
        if key in tracker._snapshot:
          metadata = tracker._snapshot[key].metadata
        else:
          metadata = entity_pb.EntityMetadata()
        metadata.set_updated_version(self.GetMutationVersion(entity.key()))
        record = EntityRecord(entity, metadata)
        self._txn_manager._Put(record, insert)


      for key in tracker._delete.itervalues():
        self._txn_manager._Delete(key)


      tracker._read_pos = EntityGroupTracker.APPLIED


      tracker._meta_data.Unlog(self)
    finally:
      self._apply_lock.release()
dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/datastore/datastore_stub_util.py/LiveTxn._Apply/original