def send(signal, sender=None, **kwds):
    """Send signal from sender to all connected receivers.
    
    Return a list of tuple pairs [(receiver, response), ... ].
    If sender is None, signal is sent anonymously."""
    signal = str(signal)
    senderkey = id(sender)
    anykey = id(Any)
    # Get receivers that receive *this* signal from *this* sender.
    receivers = []
    try: receivers.extend(connections[senderkey][signal])
    except KeyError: pass
    # Add receivers that receive *any* signal from *this* sender.
    anyreceivers = []
    try: anyreceivers = connections[senderkey][Any]
    except KeyError: pass
    for receiver in anyreceivers:
        if receivers.count(receiver) == 0:
            receivers.append(receiver)
    # Add receivers that receive *this* signal from *any* sender.
    anyreceivers = []
    try: anyreceivers = connections[anykey][signal]
    except KeyError: pass
    for receiver in anyreceivers:
        if receivers.count(receiver) == 0:
            receivers.append(receiver)
    # Add receivers that receive *any* signal from *any* sender.
    anyreceivers = []
    try: anyreceivers = connections[anykey][Any]
    except KeyError: pass
    for receiver in anyreceivers:
        if receivers.count(receiver) == 0:
            receivers.append(receiver)
    # Call each receiver with whatever arguments it can accept.
    # Return a list of tuple pairs [(receiver, response), ... ].
    responses = []
    for receiver in receivers:
        if type(receiver) is weakref.ReferenceType \
        or isinstance(receiver, BoundMethodWeakref):
            # Dereference the weak reference.
            receiver = receiver()
            if receiver is None:
                # This receiver is dead, so skip it.
                continue
        response = _call(receiver, signal=signal, sender=sender, **kwds)
        responses += [(receiver, response)]
    return responses
Send signal from sender to all connected receivers.
    
    Return a list of tuple pairs [(receiver, response), ... ].
    If sender is None, signal is sent anonymously.
recipes/Python/87056_Global_Signal_Dispatching/recipe-87056.py