code: def on(signals, callback=None, max_calls=None):
      
      if isinstance(callback, int) or callback is None:
          # Decorated
          if isinstance(callback, int):
              # Here the args were passed arg-style, not kwarg-style
              callback, max_calls = max_calls, callback
          return partial(_on, signals, max_calls=max_calls)
      elif isinstance(callback, types.MethodType):
          # callback is a bound instance method, so we need to wrap it in a function
          def _callback(*args, **kwargs):
              return callback(*args, **kwargs)
          return _on(signals, _callback, max_calls=max_calls)
      else:
          # Function call
          return _on(signals, callback, max_calls=max_calls)
docs: Registers a single callback for receiving an event (or event list). Optionally,
      can specify a maximum number of times the callback should receive a signal. This
      method works as both a function and a decorator::
  
          smokesignal.on('foo', my_callback)
  
          @smokesignal.on('foo')
          def my_callback():
              pass
  
      :param signals: A single signal or list/tuple of signals that callback should respond to
      :param callback: A callable that should repond to supplied signal(s)
      :param max_calls: Integer maximum calls for callback. None for no limit.