def _on(on_signals, callback, max_calls=None):
    if not callable(callback):
        raise AssertionError('Signal callbacks must be callable')

    # Support for lists of signals
    if not isinstance(on_signals, (list, tuple)):
        on_signals = [on_signals]

    callback._max_calls = max_calls

    # Register the callback
    for signal in on_signals:
        receivers[signal].add(callback)

    # Setup responds_to partial for use later
    if not hasattr(callback, 'responds_to'):
        callback.responds_to = partial(responds_to, callback)

    # Setup signals partial for use later.
    if not hasattr(callback, 'signals'):
        callback.signals = partial(signals, callback)

    # Setup disconnect partial for user later
    if not hasattr(callback, 'disconnect'):
        callback.disconnect = partial(disconnect, callback)

    # Setup disconnect_from partial for user later
    if not hasattr(callback, 'disconnect_from'):
        callback.disconnect_from = partial(disconnect_from, callback)

    return callback
Identify a master to run the given job on.
dataset/ETHPy150Open shaunduncan/smokesignal/smokesignal.py/_on--crossover with--dataset/ETHPy150Open dropbox/changes/changes/backends/jenkins/builder.py/JenkinsBuilder._pick_master