<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def menu_item_remove_libraries_or_root_clicked(self, menu_item):
 """Removes library from hard drive after request second confirmation"""


        menu_item_text = self.get_menu_item_text(menu_item)

        logger.info("Delete item '{0}' pressed.".format(menu_item_text))
        model, path = self.view.get_selection().get_selected()
        if path:
            # Second confirmation to delete library
            tree_m_row = self.tree_store[path]
            library_os_path, library_path, library_name, item_key = self.extract_library_properties_from_selected_row()
            # assert isinstance(tree_m_row[self.ITEM_STORAGE_ID], str)
            library_file_system_path = library_os_path

            if "root" in menu_item_text:
                button_texts = [menu_item_text + "from tree and config", "Cancel"]
                partial_message = "This will remove the library root from your configuration (config.yaml)."
            else:
                button_texts = [menu_item_text, "Cancel"]
                partial_message = "This folder will be removed from hard drive! You really wanna do that?"

            message_string = "You choose to {2} with " \
                             "\n\nlibrary tree path:   {0}" \
                             "\n\nphysical path:        {1}.\n\n\n"\
                             "{3}" \
                             "".format(os.path.join(self.convert_if_human_readable(tree_m_row[self.LIB_PATH_STORAGE_ID]),
                                                    item_key),
                                       library_file_system_path,
                                       menu_item_text.lower(),
                                       partial_message)

            width = 8*len("physical path:        " + library_file_system_path)
            dialog = RAFCONButtonDialog(message_string, button_texts, message_type=Gtk.MessageType.QUESTION,
                                        parent=self.get_root_window(), width=min(width, 1400))
            response_id = dialog.run()
            dialog.destroy()
            if response_id == 1:
                if "root" in menu_item_text:
                    logger.info("Remove library root key '{0}' from config.".format(item_key))
                    from rafcon.gui.singleton import global_config
                    library_paths = global_config.get_config_value('LIBRARY_PATHS')
                    del library_paths[tree_m_row[self.LIB_KEY_STORAGE_ID]]
                    global_config.save_configuration()
                    self.model.library_manager.refresh_libraries()
                elif "libraries" in menu_item_text:
                    logger.debug("Remove of all libraries in {} is triggered.".format(library_os_path))
                    import shutil
                    shutil.rmtree(library_os_path)
                    self.model.library_manager.refresh_libraries()
                else:

                    logger.debug("Remove of Library {} is triggered.".format(library_os_path))
                    self.model.library_manager.remove_library_from_file_system(library_path,
                                                                               library_name)
            elif response_id in [2, -4]:
                pass
            else:
                logger.warning("Response id: {} is not considered".format(response_id))

            return True
        return False