code: def on(self, type):
          '''Decorator function'''
          def decorator(self, func):
              '''decorated functions should be written as class methods
                  @on('join')
                  def on_join(self, channel):
                      print("Joined channel %s" % channel)
              '''
              self._handlers[type].append(func)
              return func
  
          return decoratof on(self, type):
          '''Decorator function'''
          def decorator(self, func):
              '''decorated functions should be written as class methods
                  @on('join')
                  def on_join(self, channel):
                      print("Joined channel %s" % channel)
              '''
              self._handlers[type].append(func)
              return func
  
          return decorator
docs: Decorator function