'Converts a v3 Property to a v4 Value.
Args:
v3_property: an entity_pb.Property
indexed: whether the v3 property is indexed
v4_value: an entity_v4_pb.Value to populate'

def v3_property_to_v4_value(self, v3_property, indexed, v4_value):

    v4_value.Clear()
    v3_property_value = v3_property.value()
    v3_meaning = v3_property.meaning()
    v3_uri_meaning = None
    if v3_property.meaning_uri():
        v3_uri_meaning = v3_property.meaning_uri()
    if (not self.__is_v3_property_value_union_valid(v3_property_value)):
        v3_meaning = None
        v3_uri_meaning = None
    elif (v3_meaning == entity_pb.Property.NO_MEANING):
        v3_meaning = None
    elif (not self.__is_v3_property_value_meaning_valid(v3_property_value, v3_meaning)):
        v3_meaning = None
    is_zlib_value = False
    if v3_uri_meaning:
        if (v3_uri_meaning == URI_MEANING_ZLIB):
            if v3_property_value.has_stringvalue():
                is_zlib_value = True
                if (v3_meaning != entity_pb.Property.BLOB):
                    v3_meaning = entity_pb.Property.BLOB
            else:
                pass
        else:
            pass
    if v3_property_value.has_booleanvalue():
        v4_value.set_boolean_value(v3_property_value.booleanvalue())
    elif v3_property_value.has_int64value():
        if (v3_meaning == entity_pb.Property.GD_WHEN):
            v4_value.set_timestamp_microseconds_value(v3_property_value.int64value())
            v3_meaning = None
        else:
            v4_value.set_integer_value(v3_property_value.int64value())
    elif v3_property_value.has_doublevalue():
        v4_value.set_double_value(v3_property_value.doublevalue())
    elif v3_property_value.has_referencevalue():
        v3_ref = entity_pb.Reference()
        self.__v3_reference_value_to_v3_reference(v3_property_value.referencevalue(), v3_ref)
        self.v3_to_v4_key(v3_ref, v4_value.mutable_key_value())
    elif v3_property_value.has_stringvalue():
        if (v3_meaning == entity_pb.Property.ENTITY_PROTO):
            serialized_entity_v3 = v3_property_value.stringvalue()
            v3_entity = entity_pb.EntityProto()
            v3_entity.ParsePartialFromString(serialized_entity_v3)
            self.v3_to_v4_entity(v3_entity, v4_value.mutable_entity_value())
            v3_meaning = None
        elif ((v3_meaning == entity_pb.Property.BLOB) or (v3_meaning == entity_pb.Property.BYTESTRING)):
            v4_value.set_blob_value(v3_property_value.stringvalue())
            if (indexed or (v3_meaning == entity_pb.Property.BLOB)):
                v3_meaning = None
        else:
            string_value = v3_property_value.stringvalue()
            if is_valid_utf8(string_value):
                if (v3_meaning == entity_pb.Property.BLOBKEY):
                    v4_value.set_blob_key_value(string_value)
                    v3_meaning = None
                else:
                    v4_value.set_string_value(string_value)
            else:
                v4_value.set_blob_value(string_value)
                if (v3_meaning != entity_pb.Property.INDEX_VALUE):
                    v3_meaning = None
    elif v3_property_value.has_pointvalue():
        if (v3_meaning == MEANING_GEORSS_POINT):
            point_value = v3_property_value.pointvalue()
            v4_value.mutable_geo_point_value().set_latitude(point_value.x())
            v4_value.mutable_geo_point_value().set_longitude(point_value.y())
        else:
            self.__v3_to_v4_point_entity(v3_property_value.pointvalue(), v4_value.mutable_entity_value())
            v4_value.set_meaning(MEANING_PREDEFINED_ENTITY_POINT)
        v3_meaning = None
    elif v3_property_value.has_uservalue():
        self.v3_user_value_to_v4_entity(v3_property_value.uservalue(), v4_value.mutable_entity_value())
        v4_value.set_meaning(MEANING_PREDEFINED_ENTITY_USER)
        v3_meaning = None
    else:
        pass
    if is_zlib_value:
        v4_value.set_meaning(MEANING_ZLIB)
    elif v3_meaning:
        v4_value.set_meaning(v3_meaning)
    if (indexed != v4_value.indexed()):
        v4_value.set_indexed(indexed)
