def LoadEntity(entity, keys_only=False, property_names=None):
 if entity:
  clone = entity_pb.EntityProto()
  if property_names:
   clone.mutable_key().CopyFrom(entity.key())
   clone.mutable_entity_group()
   seen = set()
   for prop in entity.property_list():
    if (prop.name() in property_names):
     Check((prop.name() not in seen), 'datastore dev stub produced bad result', datastore_pb.Error.INTERNAL_ERROR)
     seen.add(prop.name())
     new_prop = clone.add_property()
     new_prop.set_name(prop.name())
     new_prop.set_meaning(entity_pb.Property.INDEX_VALUE)
     new_prop.mutable_value().CopyFrom(prop.value())
     new_prop.set_multiple(False)
  elif keys_only:
   clone.mutable_key().CopyFrom(entity.key())
   clone.mutable_entity_group()
  else:
   clone.CopyFrom(entity)
  PrepareSpecialPropertiesForLoad(clone)
  return clone

def LoadEntity ( entity , keys_only = False , property_names = None ) : if entity : clone = entity_pb . EntityProto ( ) if property_names : clone . mutable_key ( ) . CopyFrom ( entity . key ( ) ) clone . mutable_entity_group ( ) seen = set ( ) for prop in entity . property_list ( ) : if ( prop . name ( ) in property_names ) : Check ( ( prop . name ( ) not in seen ) , 'datastore dev stub produced bad result' , datastore_pb . Error . INTERNAL_ERROR ) seen . add ( prop . name ( ) ) new_prop = clone . add_property ( ) new_prop . set_name ( prop . name ( ) ) new_prop . set_meaning ( entity_pb . Property . INDEX_VALUE ) new_prop . mutable_value ( ) . CopyFrom ( prop . value ( ) ) new_prop . set_multiple ( False ) elif keys_only : clone . mutable_key ( ) . CopyFrom ( entity . key ( ) ) clone . mutable_entity_group ( ) else : clone . CopyFrom ( entity ) PrepareSpecialPropertiesForLoad ( clone ) return clone
prepares an entity to be returned to the user .