def _get_struct(self, name, parent): bag = Bag(name or self.name) bag._parent = parent for case in self._fields.values(): bag[case.name] = case.get_message_object(bag) return bag