'Eliminate all entries in all non-shed-related tool panel configs for all tool config file names in the received tool_configs_to_filter.'

def filter_and_persist_proprietary_tool_panel_configs(self, tool_configs_to_filter):

    for proprietary_tool_conf in self.proprietary_tool_confs:
        persist_required = False
        (tree, error_message) = xml_util.parse_xml(proprietary_tool_conf)
        if tree:
            root = tree.getroot()
            for elem in root:
                if (elem.tag == 'tool'):
                    file_path = elem.get('file', None)
                    if file_path:
                        if (file_path in tool_configs_to_filter):
                            root.remove(elem)
                            persist_required = True
                elif (elem.tag == 'section'):
                    for section_elem in elem:
                        if (section_elem.tag == 'tool'):
                            file_path = section_elem.get('file', None)
                            if file_path:
                                if (file_path in tool_configs_to_filter):
                                    elem.remove(section_elem)
                                    persist_required = True
        if persist_required:
            fh = tempfile.NamedTemporaryFile('wb', prefix='tmp-toolshed-fapptpc')
            tmp_filename = fh.name
            fh.close()
            fh = open(tmp_filename, 'wb')
            tree.write(tmp_filename, encoding='utf-8', xml_declaration=True)
            fh.close()
            shutil.move(tmp_filename, os.path.abspath(proprietary_tool_conf))
            os.chmod(proprietary_tool_conf, 420)
