def add_plugin(self, plugin, on_error, **kws):
        """Add a plugin: a module that includes a
        registerLarchPlugin function that returns
        larch_group_name, dict_of_symbol/functions
        """
        if not isinstance(plugin, types.ModuleType):
            on_error(repr(plugin) % "%s is not a valid larch plugin")

        registrar = getattr(plugin, 'registerLarchPlugin', None)
        if registrar is None:
            return
        groupname, syms = registrar()

        if not self.has_group(groupname):
            self.new_group(groupname)

        if groupname not in self._sys.searchGroups:
            self._sys.searchGroups.append(groupname)
        self._fix_searchGroups(force=True)

        for key, val in syms.items():
            if hasattr(val, '__call__'):
                # test whether plugin func has a '_larch' kw arg
                #    __code__.co_flags & 8 == 'uses **kws'
                kws.update({'func': val, '_name':key})
                nvars = val.__code__.co_argcount
                if ((val.__code__.co_flags &8 != 0) or
                    '_larch' in val.__code__.co_varnames[:nvars]):
                    kws.update({'_larch':  self._larch})
                val = Closure(**kws)
            self.set_symbol("%s.%s" % (groupname, key), val)

        plugin_init = getattr(plugin, 'initializeLarchPlugin', None)
        if plugin_init is not None:
            plugin_init(_larch=self._larch)
dataset/ETHPy150Open xraypy/xraylarch/lib/symboltable.py/SymbolTable.add_plugin/swapped operands of `%`