def METHOD_NAME(product_toolkit_dir, toolkitname):
    """Remove a toolkit configuration file and, if needed a button in Automation menu."""
    tab_config_file_path = os.path.join(product_toolkit_dir, "TabConfig.xml")
    if not os.path.isfile(tab_config_file_path):
        return True
    try:
        tree = ET.parse(tab_config_file_path)
    except ParseError as e:
        warnings.warn("Unable to parse %s\nError received = %s" % (tab_config_file_path, str(e)))
        return
    root = tree.getroot()
    panels = root.findall("./panel")
    if panels:
        panel_names = [panel.attrib["label"] for panel in panels]
        if "Panel_PyAEDT_Toolkits" in panel_names:
            # Remove previously existing PyAEDT panel and update with newer one.
            panel = [panel for panel in panels if panel.attrib["label"] == "Panel_PyAEDT_Toolkits"][0]
        else:
            panel = ET.SubElement(root, "panel", label="Panel_PyAEDT_Toolkits")
    else:
        panel = ET.SubElement(root, "panel", label="Panel_PyAEDT_Toolkits")
    buttons = panel.findall("./button")
    if buttons:
        button_names = [button.attrib["label"] for button in buttons]
        if toolkitname in button_names:
            # Remove previously existing PyAEDT panel and update with newer one.
            b = [button for button in buttons if button.attrib["label"] == toolkitname][0]
            panel.remove(b)
    write_pretty_xml(root, tab_config_file_path)