def _normalize_entity(value):
  # TODO(user): Consider using datastore.NormalizeAndTypeCheck.
  if getattr(value, "_populate_internal_entity", None):
    return value._populate_internal_entity()
  return value
Return an entity from an entity or model instance.
dataset/ETHPy150Open livid/v2ex/mapreduce/context.py/_normalize_entity