def add(self, parent, name, value=None, attrs={}): """Produce an xml element e with parent parent, optionally with value v, and attributes attrs. If value is specified, it will be placed in the element as a text node. Returns the generated element.""" e = etree.SubElement(parent, name, attrs) if value is not None: e.text = value return e