def METHOD_NAME(self, type, plugin):
    if self.config.get("use_{}_list".format(type)):
        plugin_list = self.config.get("{}_list".format(type))
        plugin_list = plugin_list.replace(" ", "").replace("\\", "")
        plugin_list = plugin_list.replace("|", ",").replace(";", ",")
        plugin_list = plugin_list.lower().split(",")
        plugin_set = set(plugin_list)
        if self.config.get("use_builtin_list"):
            builtin_list = getattr(self, "BUILTIN_{}S".format(type.upper()))
            plugin_set.update(builtin_list)
        plugin_set.difference_update(("", ""))
        if not plugin_set:
            self.log_info(self._("No {} to handle").format(type))
            return
        match_list = "|".join(sorted(plugin_set)).replace(".", r"\.")
        pattern = self._regexmap[type][1].format(match_list)
        self.log_info(
            self._("Handle {} {}{}: {}").format(
                len(plugin_set),
                type,
                "" if len(plugin_set) == 1 else "s",
                match_list.replace(r"\.", ".").replace("|", ", "),
            )
        )
    else:
        plugin_list = []
        is_xfs = lambda klass: any(
            k.__name__.startswith("XFS") for k in inspect.getmro(klass)
        )
        for p in self.pyload.plugin_manager.plugins[type].values():
            try:
                klass = self.pyload.plugin_manager.load_class(type, p["name"])
            except AttributeError as exc:
                self.log_debug(
                    exc,
                    exc_info=self.pyload.debug > 1,
                    stack_info=self.pyload.debug > 2,
                )
                continue
            if (
                hasattr(klass, "PLUGIN_DOMAIN")
                and klass.PLUGIN_DOMAIN
                and is_xfs(klass)
            ):
                plugin_list.append(klass.PLUGIN_DOMAIN)
        unmatch_list = "|".join(sorted(plugin_list)).replace(".", r"\.")
        pattern = self._regexmap[type][0].format(unmatch_list)
        self.log_info(self._("Auto-discover new {}s").format(type))
    return pattern