<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_hook(self, name, callback, prio=0):
 """ Add a new hook that can be called with the call_hook function. `prio` is the priority. Higher priority hooks are called before lower priority ones. This function does not enforce a particular order between hooks with the same priorities. """

        hook_list = self._hooks.get(name, [])

        add = (lambda *args, **kwargs: self._exception_free_callback(callback, *args, **kwargs)), -prio
        pos = bisect.bisect_right(list(x[1] for x in hook_list), -prio)
        hook_list[pos:pos] = [add]

        self._hooks[name] = hook_list