def render(self):
tpl = '<STR_LIT>'<EOL>nodes = []<EOL>msg_type = '<STR_LIT>'.format(<EOL>msg_type=self.type<EOL>)<EOL>nodes.append(msg_type)<EOL>for name, field in self._fields.items():<EOL><INDENT>value = getattr(self, name, field.default)<EOL>node_xml = field.to_xml(value)<EOL>nodes.append(node_xml)<EOL><DEDENT>data = '<STR_LIT:\n>'.join(nodes)<EOL>return tpl.format(data=data)<EOL>
Render reply from Python object to XML string