def write(self, writer):
multiline = bool(self._children)<EOL>newline_start = multiline and not bool(self.data)<EOL>writer.start(self.tagname, self.attrs, newline=newline_start)<EOL>if self.data:<EOL><INDENT>writer.data(self.data, newline=bool(self._children))<EOL><DEDENT>for c in self._children:<EOL><INDENT>c.write(writer)<EOL><DEDENT>writer.end(self.tagname, indent=multiline)<EOL>
Writes an XML representation of this node (including descendants) to the specified file-like object.

:param writer: An :class:`XmlWriter` instance to write this node to