def listen(obj, name, func):
    """
    Arrange for `func(*args, **kwargs)` to be invoked when the named signal is
    fired by `obj`.
    """
    signals = vars(obj).setdefault('_signals', {})
    signals.setdefault(name, []).append(func)
Arrange for `func(*args, **kwargs)` to be invoked when the named signal is
    fired by `obj`.