def unregister_handler(self, handler_or_func):
index = -<NUM_LIT:1><EOL>for i, handler in enumerate(self._direct_handlers):<EOL><INDENT>if handler is handler_or_func or handler._original_func is handler_or_func:<EOL><INDENT>index = i<EOL>break<EOL><DEDENT><DEDENT>if index >= <NUM_LIT:0>:<EOL><INDENT>self._direct_handlers.pop(index)<EOL>self._cached_handlers = None<EOL><DEDENT>elif self.parent_class_hook is not None and self.parent_class_hook.has_handler(handler_or_func):<EOL><INDENT>self.parent_class_hook.unregister_handler(handler_or_func)<EOL>self._cached_handlers = None<EOL><DEDENT>elif self.instance_class_hook is not None and self.instance_class_hook.has_handler(handler_or_func):<EOL><INDENT>self.instance_class_hook.unregister_handler(handler_or_func)<EOL>self._cached_handlers = None<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>'.format(handler_or_func, self))<EOL><DEDENT>
Remove the handler from this hook's list of handlers.
This does not give up until the handler is found in the class hierarchy.