'Retrieve the primitive used to encode the attribute.
This method allows to bypass the semantic coercion on semantic fields in
order to retrieve the primitive protobuf member. This should only even be
done for invalid protobufs which can not parse the primitive into an object
type. In other words this is a major hack and should be used sparingly.
Args:
attr: The name of the attribute to retrieve.
Returns:
A primitive (int, string, etc) encoded in the field.'

def GetPrimitive(self, attr):

    entry = self._data.get(attr)
    if (entry is None):
        return ''
    (python_format, wire_format, type_descriptor) = entry
    if (wire_format is None):
        wire_format = type_descriptor.ConvertToWireFormat(python_format)
    return type_descriptor.primitive_desc.ConvertFromWireFormat(wire_format)
