def _GetPrimitiveEncoder(self):
    # Decide what should the primitive type be for packing the target rdfvalue
    # into the protobuf and create a delegate descriptor to control that.
    primitive_cls = self._PROTO_DATA_STORE_LOOKUP[self.type.data_store_type]
    self.primitive_desc = primitive_cls(**self._kwargs)

    # Our wiretype is the same as the delegate's.
    self.wire_type = self.primitive_desc.wire_type
    self.proto_type_name = self.primitive_desc.proto_type_name

    # Recalculate our tags.
    self.CalculateTags()
Finds the primitive encoder according to the type's data_store_type.
dataset/ETHPy150Open google/grr/grr/lib/rdfvalues/structs.py/ProtoRDFValue._GetPrimitiveEncoder