def map(self, key):

    mapper_params = get_mapper_params()
    target_app = mapper_params['target_app']

    if isinstance(key, datastore.Entity):

      entity = key
      key = entity.key()
    else:
      entity = datastore.Get(key)
    entity_proto = entity._ToPb()
    utils.FixKeys(entity_proto, target_app)
    target_entity = datastore.Entity._FromPb(entity_proto)

    yield operation.db.Put(target_entity)
    yield utils.AllocateMaxId(key, target_app)
    yield operation.counters.Increment(KindPathFromKey(key))
Copy data map handler.
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/ext/datastore_admin/copy_handler.py/CopyEntity.map