def disconnect(receiver, signal=Any, sender=Any, weak=1):
    """Disconnect receiver from sender for signal.
    
    Disconnecting is not required. The use of disconnect is the same as for
    connect, only in reverse. Think of it as undoing a previous connection."""
    if signal is None:
        raise DispatcherError, 'signal cannot be None'
    if signal is not Any:
        signal = str(signal)
    if weak: receiver = safeRef(receiver)
    senderkey = id(sender)
    try:
        receivers = connections[senderkey][signal]
    except KeyError:
        raise DispatcherError, \
              'No receivers for signal %s from sender %s' % \
              (repr(signal), sender)
    try:
        receivers.remove(receiver)
    except ValueError:
        raise DispatcherError, \
              'No connection to receiver %s for signal %s from sender %s' % \
              (receiver, repr(signal), sender)
    _cleanupConnections(senderkey, signal)
Disconnect receiver from sender for signal.
    
    Disconnecting is not required. The use of disconnect is the same as for
    connect, only in reverse. Think of it as undoing a previous connection.
recipes/Python/87056_Global_Signal_Dispatching/recipe-87056.py