def add_handler(self, handler):
        if not hasattr(handler, "add_parent"):
            raise TypeError("expected BaseHandler instance, got %r" %
                            type(handler))

        if self.handlers in handler:
            return
        # XXX why does self.handlers need to be sorted?
        bisect.insort(self.handlers, handler)
        handler.add_parent(self)
        self._handler_index_valid = False
dataset/ETHPy150Open Masood-M/yalih/mechanize/_opener.py/OpenerDirector.add_handler/swapped operands of `in`