def add_callback(self, name, func, args=None, kws=None):
        """set a callback to be called when set_symbol() is called
        for a named variable
        """
        try:
            var = self.get_symbol(name)
        except NameError:
            raise NameError(
                "cannot locate symbol '%s' for callback" % (name))
        key = self.get_parent(name)
        if key not in self.__callbacks:
            self.__callbacks[key] = []
        if args is None: args = ()
        if kws is None: kws = {}

        self.__callbacks[key].append((func, args, kws))
dataset/ETHPy150Open xraypy/xraylarch/lib/symboltable.py/SymbolTable.add_callback/original