'Connect receiver to sender for signal.
Arguments:
receiver (Callable): A function or an instance method which is to
receive signals.  Receivers must be hashable objects.
if weak is :const:`True`, then receiver must be
weak-referenceable.
Receivers must be able to accept keyword arguments.
If receivers have a `dispatch_uid` attribute, the receiver will
not be added if another receiver already exists with that
`dispatch_uid`.
sender (Any): The sender to which the receiver should respond.
Must either be a Python object, or :const:`None` to
receive events from any sender.
weak (bool): Whether to use weak references to the receiver.
By default, the module will attempt to use weak references to
the receiver objects.  If this parameter is false, then strong
references will be used.
dispatch_uid (Hashable): An identifier used to uniquely identify a
particular instance of a receiver.  This will usually be a
string, though it may be anything hashable.'

def connect(self, *args, **kwargs):

    def _handle_options(sender=None, weak=True, dispatch_uid=None):
        def _connect_signal(fun):
            self._connect_signal(fun, sender, weak, dispatch_uid)
            return fun
        return _connect_signal
    if (args and callable(args[0])):
        return _handle_options(*args[1:], **kwargs)(args[0])
    return _handle_options(*args, **kwargs)
