def trigger_hook(self, name, *args, **kwargs):
        """Recursively call a method named ``name`` with the provided args and
        keyword args if defined."""
        method = getattr(self, name, None)
        if is_callable(method):
            method(*args, **kwargs)
            
        try:
            children = self.children
        except AttributeError:
            return
        else:
            if children is not None:
                for child in children:
                    method = getattr(child, 'trigger_hook', None)
                    if is_callable(method):
                        method(name, *args, **kwargs)
                    else:
                        method = getattr(child, name, None)
                        if is_callable(method):
                            method(*args, **kwargs)
def trigger_hook ( self , name , * args , ** kwargs ) : method = getattr ( self , name , None ) if is_callable ( method ) : method ( * args , ** kwargs ) try : children = self . children except AttributeError : return else : if children is not None : for child in children : method = getattr ( child , 'trigger_hook' , None ) if is_callable ( method ) : method ( name , * args , ** kwargs ) else : method = getattr ( child , name , None ) if is_callable ( method ) : method ( * args , ** kwargs )
Recursively call a method named ``name`` with the provided args and
        keyword args if defined.