def remove_plugin_dir(self, path):
        if not self.config.has_section('plugins'):
            return

        girder_plugin_dir = set([os.path.join(self.module.params['girder_dir'],
                                              "plugins")])

        # If single string, convert to list
        if isinstance(path, basestring):
            path = set([path])
        else:
            path = set(path)

        self.message['debug']['path'] = list(path)

        try:
            plugin_dirs = set(self.config.get("plugins",
                                              "plugin_directory").split(":"))

            # Remove girder_plugin_dir if it exists
            plugin_dirs = plugin_dirs - girder_plugin_dir

            # If there are common path between plugin_dirs and path
            # We are about to affect a change
            self.changed = bool(len(plugin_dirs & path))

            if self.changed:
                # We've only got the girder_plugin directory left in
                # plugin_directory

                leftover = plugin_dirs - path

                if len(leftover) == 0:
                    # If all we've got left is the girder plugin dirctory
                    self.config.remove_option("plugins", "plugin_directory")
                    # If that was it in the plugins section,  remove that too
                    if len(self.config.items("plugins")) == 0:
                        self.config.remove_section("plugins")
                else:
                    # Add girder_plugin_dir back in at the front of the list
                    plugin_dirs = list(girder_plugin_dir) + list(leftover)

                    self.config.set("plugins", "plugin_directory",
                                    "\"" + ":".join(plugin_dirs) + "\"")

            return

        except cp.NoOptionError:
            return
dataset/ETHPy150Open Kitware/minerva/ansible/library/girder_plugin_dir.py/GirderPluginDirModule.remove_plugin_dir/original