def Put(entities):
  entities, multiple = NormalizeAndTypeCheck(entities, Entity)

  if multiple and not entities:
    return []

  for entity in entities:
    if not entity.kind() or not entity.app_id_namespace():
      raise datastore_errors.BadRequestError(
          'App and kind must not be empty, in entity: %s' % entity)

  req = datastore_pb.PutRequest()
  req.entity_list().extend([e._ToPb() for e in entities])

  keys = [e.key() for e in entities]
  tx = _MaybeSetupTransaction(req, keys)

  try:
    resp = _MakeSyncCall('datastore_v3', 'Put', req, datastore_pb.PutResponse())
  except apiproxy_errors.ApplicationError, err:
    raise _ToDatastoreError(err)

  keys = resp.key_list()
  num_keys = len(keys)
  num_entities = len(entities)
  if num_keys != num_entities:
    raise datastore_errors.InternalError(
        'Put accepted %d entities but returned %d keys.' %
        (num_entities, num_keys))

  for entity, key in zip(entities, keys):
    entity._Entity__key._Key__reference.CopyFrom(key)

  if tx:
    tx.entity_group = entities[0].entity_group()

  if multiple:
    return [Key._FromPb(k) for k in keys]
  else:
    return Key._FromPb(resp.key(0))
Called when an Accepted message is received from an acceptor
dataset/ETHPy150Open CollabQ/CollabQ/.google_appengine/google/appengine/api/datastore.py/Put--crossover with--dataset/ETHPy150Open cocagne/paxos/paxos/essential.py/Learner.recv_accepted