code: def remove_resource_value(issue, filepath):
      
      if os.path.exists(filepath):
          for element in issue.elements:
              print('removing {0} from resource {1}'.format(element, filepath))
              parser = etree.XMLParser(remove_blank_text=False, remove_comments=False,
                                       remove_pis=False, strip_cdata=False, resolve_entities=False)
              tree = etree.parse(filepath, parser)
              root = tree.getroot()
              for unused_value in root.findall('.//{0}[@name="{1}"]'.format(element[0], element[1])):
                  root.remove(unused_value)
              with open(filepath, 'wb') as resource:
                  tree.write(resource, encoding='utf-8', xml_declaration=True)
docs: Read an xml file and remove an element which is unused, then save the file back to the filesystem