def __new__(cls, *args, **kw):
        
        # creating new instance (cls is just a Class)
        self = super(Node, cls).__new__(cls)
        
        # will handle our event handlers here
        self.__events__ = {}
        
        # loop over cls (not instance, instance's __init__ has not been called yet)
        for item in cls.__dict__.values():
            if hasattr(item, '__event_handler__'):
                ev_name = getattr(item, '__event_handler__')
                ev_name, args, kw = getattr(item, '__event_handler__')
                # our handlers could have args and kwargs as well
                self.__events__[ev_name] = [item, args, kw]
            
        return self
Customizing Node subclass creation. Catching method decorators
dataset/ETHPy150Open selfsk/nodeset.core/src/nodeset/core/node.py/Node.__new__