py2xml. re-write with a much saner implementation.