code: def remove_xml_element(name, tree):
      
      # root = tree.getroot()
      remove = tree.findall(
          ".//{{http://soap.sforce.com/2006/04/metadata}}{}".format(name)
      )
      if not remove:
          return tree
  
      parent_map = {c: p for p in tree.iter() for c in p}
  
      for elem in remove:
          parent = parent_map[elem]
          parent.remove(elem)
  
      return tree
docs: Removes XML elements from an ElementTree content tree