def add_element_to_doc(doc, tag, value):
element = doc.find("<STR_LIT>" % tag)<EOL>if element is None:<EOL><INDENT>element = etree.SubElement(doc, tag)<EOL><DEDENT>element.text = value<EOL>
Set text value of an etree.Element of tag, appending a new element with given tag if it doesn't exist.