Add handler instance and attach any events to it.

        :param object handler: handler instance
        :param bool allow_dupe: If True, allow registering a handler more than once.
        :return object: The handler you added is given back so this can be used as a decorator.

def _add(self, handler, allow_dupe=False, send_event=True):
        """
        Add handler instance and attach any events to it.

        :param object handler: handler instance
        :param bool allow_dupe: If True, allow registering a handler more than once.
        :return object: The handler you added is given back so this can be used as a decorator.
        """
        if not allow_dupe and handler in self.handlers:
            raise ValueError("Handler already present: %s" % handler)
        self.handlers.append(handler)
        self._attach_handler_events(handler)
        if send_event:
            self.on_handler_add(handler)