code: def tree_node_to_xml(self, parent, item):
          
  
          tree = self.treeview
          data = self.treedata[item]
          node = data.to_xml_node()
  
          children = tree.get_children(item)
          for child in children:
              cnode = ET.Element('child')
              cwidget = self.tree_node_to_xml(item, child)
              cnode.append(cwidget)
              node.append(cnode)
  
          return node
docs: Converts a treeview item and children to xml nodes