import sys
from xml.etree.cElementTree import Element, ElementTree

def make_xml():
    node = Element('foo')
node.text = 'bar'
doc = ElementTree(node)
return doc
if __name__ == '__main__':
    make_xml().write(sys.stdout)
How do I create an xml document in python