for the xml
data1 data2
parent_map = dict((c, p) for p in tree.getiterator() for c in p) parent_map[el].remove(el)