def FromReferenceProperty(value):
 assert isinstance(value, entity_pb.PropertyValue)
 assert value.has_referencevalue()
 ref = value.referencevalue()
 key = Key()
 key_ref = key._Key__reference
 key_ref.set_app(ref.app())
 SetNamespace(key_ref, ref.name_space())
 for pathelem in ref.pathelement_list():
  key_ref.mutable_path().add_element().CopyFrom(pathelem)
 return key

def FromReferenceProperty ( value ) : assert isinstance ( value , entity_pb . PropertyValue ) assert value . has_referencevalue ( ) ref = value . referencevalue ( ) key = Key ( ) key_ref = key . _Key__reference key_ref . set_app ( ref . app ( ) ) SetNamespace ( key_ref , ref . name_space ( ) ) for pathelem in ref . pathelement_list ( ) : key_ref . mutable_path ( ) . add_element ( ) . CopyFrom ( pathelem ) return key
converts a reference propertyvalue to a key .