code: def on(message):
      '''Decorator that register a class method as callback for a message.'''
      def decorator(function):
          try:
              function._callback_messages.append(message)
          except AttributeError:
              function._callback_messages = [message]
          return function
      return decoratof on(message):
      '''Decorator that register a class method as callback for a message.'''
      def decorator(function):
          try:
              function._callback_messages.append(message)
          except AttributeError:
              function._callback_messages = [message]
          return function
      return decorator
docs: Decorator that register a class method as callback for a message.