def save_to_xml(self, root_name, childname, values_dict, filepath): x = XmlController() x.create_root(root_name) for key, value in values_dict.items(): x.create_sub_element(childname, 'root') x.set_text(value, childname) x.set_value('type',key, childname) x.save_file(filepath)