@classmethod
        def _listen(cls, event_key, raw=False, propagate=False, **kw):
            target, identifier, fn = \
                event_key.dispatch_target, event_key.identifier, event_key.fn

            if target.class_ in target.all_holds:
                collection = target.all_holds[target.class_]
            else:
                collection = target.all_holds[target.class_] = {}

            event.registry._stored_in_collection(event_key, target)
            collection[event_key._key] = (event_key, raw, propagate)

            if propagate:
                stack = list(target.class_.__subclasses__())
                while stack:
                    subclass = stack.pop(0)
                    stack.extend(subclass.__subclasses__())
                    subject = target.resolve(subclass)
                    if subject is not None:
                        # we are already going through __subclasses__()
                        # so leave generic propagate flag False
                        event_key.with_dispatch_target(subject).\
                            listen(raw=raw, propagate=False, **kw)
dataset/ETHPy150Open zzzeek/sqlalchemy/lib/sqlalchemy/orm/events.py/_EventsHold.HoldEvents._listen/original