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)
Test we can process one message.
dataset/ETHPy150Open shaunduncan/smokesignal/smokesignal.py/on--crossover with--dataset/ETHPy150Open wingu/failnozzle/failnozzle/tests/test_server.py/test_process_one_message