(target, **hooks)
Given the target `target`, apply the hooks given as keyword arguments to it.
        If any targeted method has already been hooked, the hooks will not be overridden but will instead be pushed
        into a list of pending hooks. The final behavior should be that all hooks call each other in a nested stack.

        :param target:  Any object. Its methods named as keys in `hooks` will be replaced by `HookedMethod` objects.
        :param hooks:   Any keywords will be interpreted as hooks to apply. Each method named will hooked with the
                        coresponding function value.
Given the target `target`, apply the hooks given as keyword arguments to it.
        If any targeted method has already been hooked, the hooks will not be overridden but will instead be pushed
        into a list of pending hooks. The final behavior should be that all hooks call each other in a nested stack.
Given the target target apply the hooks given as keyword arguments to it . If any targeted method has already been hooked the hooks will not be overridden but will instead be pushed into a list of pending hooks . The final behavior should be that all hooks call each other in a nested stack .
def install_hooks(target, **hooks):
        """
        Given the target `target`, apply the hooks given as keyword arguments to it.
        If any targeted method has already been hooked, the hooks will not be overridden but will instead be pushed
        into a list of pending hooks. The final behavior should be that all hooks call each other in a nested stack.

        :param target:  Any object. Its methods named as keys in `hooks` will be replaced by `HookedMethod` objects.
        :param hooks:   Any keywords will be interpreted as hooks to apply. Each method named will hooked with the
                        coresponding function value.
        """
        for name, hook in hooks.items():
            func = getattr(target, name)
            if not isinstance(func, HookedMethod):
                func = HookedMethod(func)
                setattr(target, name, func)
            func.pending.append(hook)
def install_hooks ( target , * * hooks ) : for name , hook in hooks . items ( ) : func = getattr ( target , name ) if not isinstance ( func , HookedMethod ) : func = HookedMethod ( func ) setattr ( target , name , func ) func . pending . append ( hook )