def __restore_type(self, message):
        message_type, g = MessageType(), globals()
        for field in message.fields:
            field_type = field['type']
            if not field_type in g:
                raise TypeError('Primitive type \'%s\' not found in this protobuf module.' % field_type)
            field_info = (field.tag, field.name, g[field_type], field.flags)
            if field.flags & Flags.EMBEDDED_MASK == Flags.EMBEDDED:
                field_info[3] -= Flags.EMBEDDED
                field_info[2] = EmbeddedMessage(self.__restore_type(field.embedded))
            message_type.add_field(*field_info)
        return message_type
Templatetags provided for convenience
dataset/ETHPy150Open eigenein/protobuf/protobuf.py/TypeMetadataType.__restore_type--crossover with--dataset/ETHPy150Open magopian/django-data-exports/data_exports/tests.py/ExportTest.test_export_templatetag