Generating svg from xml with python etree

Python rocks at managing xml files. Having to convert some vss shapes to odt, I just:

# vss2xhtml file.vss > file.xhtml

Then I parsed the xhtml containing multiple images with python

from xml.etree import ElementTree as ET
xml_header = """
        
        """
tree = ET.parse("file.xhtml")
# get all the images
images = tree.findall(r'//{http://www.w3.org/2000/svg}svg')

# enumerate avoids i=0, i+=1
for i, x in enumerate(images):
    destination_file = "image_%s.svg" % i
    with open(destination_file, 'w') as fd:
        fd.write(xml_header)
        fd.write(ET.tostring(x))