<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _invoke_hook(hook_name, target):
 """ Generic hook invocation. """

    try:
        for value in getattr(target, hook_name):
            func, args, kwargs = value
            func(target, *args, **kwargs)
    except AttributeError:
        # no hook defined
        pass
    except (TypeError, ValueError):
        # hook not properly defined (might be a mock)
        pass