def _MaybeSetupTransaction(request, keys):
  assert isinstance(request, (datastore_pb.GetRequest, datastore_pb.PutRequest,
                              datastore_pb.DeleteRequest, datastore_pb.Query,
                              taskqueue_service_pb.TaskQueueAddRequest,
                              )), request.__class__
  tx_key = None

  try:
    tx_key = _CurrentTransactionKey()
    if tx_key:
      tx = _txes[tx_key]

      groups = [k.entity_group() for k in keys]
      if tx.entity_group:
        expected_group = tx.entity_group
      elif groups:
        expected_group = groups[0]
      else:
        expected_group = None

      for group in groups:
        if (group != expected_group or







            (not group.has_id_or_name() and group is not expected_group)):
          raise _DifferentEntityGroupError(expected_group, group)

        if not tx.entity_group and group.has_id_or_name():
          tx.entity_group = group

      assert tx.handle.IsInitialized()
      request.mutable_transaction().CopyFrom(tx.handle)

      return tx

  finally:
    del tx_key
Very basic tokenizer: split the sentence into a list of tokens.
dataset/ETHPy150Open CollabQ/CollabQ/.google_appengine/google/appengine/api/datastore.py/_MaybeSetupTransaction--crossover with--dataset/ETHPy150Open tokestermw/tensorflow-shakespeare/tensorshake/translate/data_utils.py/basic_tokenizer