@classmethod<EOL><INDENT>def on(cls, event, handler_func=None):<DEDENT>
if handler_func:<EOL><INDENT>cls.handler_registrar().register(event, handler_func)<EOL>return<EOL><DEDENT>def register(fn):<EOL><INDENT>cls.handler_registrar().register(event, fn)<EOL>return fn<EOL><DEDENT>return register<EOL>
Registers a handler function whenever an instance of the model
emits the given event.

This method can either called directly, passing a function reference:

    MyModel.on('did_save', my_function)

...or as a decorator of the function to be registered.

    @MyModel.on('did_save')
    def myfunction(my_model):
        pass