def connect(host, port, protocol, *proto_args, **proto_kwargs):
    deferredResult = defer.Deferred()

    proto_args += (deferredResult,)

    if 'timeout' in proto_kwargs:
        timeout = proto_kwargs.pop('timeout')
    else:
        timeout = None

    try: #dmx work around
        import config
        reactor = config.reactor
    except:
        from twisted.internet import reactor
    connector = ClientCreator(reactor, protocol, *proto_args, **proto_kwargs)
    deferredConnect = connector.connectTCP(host, port)

    from kitt.decorators import debugCall
    if 'debug' in proto_kwargs and proto_kwargs['debug'] == True:
        deferredResult.errback = debugCall( deferredResult.errback )
        deferredResult.callback = debugCall( deferredResult.callback )

    #If the connection fails the protocol task fails
    deferredConnect.addErrback(lambda failure: deferredResult.called or 
                               deferredResult.errback(failure))

    if timeout:
        reactor.callLater(timeout, cancelTask, deferredResult)


    #Inject the server name and port into the results in the callback chain
    def injectServer(outcome):
        if isinstance(outcome, dict):
            outcome['server'] = proto_kwargs.get('hostname',host)
            outcome['port'] = port
        elif isinstance(outcome, Failure) and outcome.check(DroneCommandFailed):
            outcome.value.resultContext['server'] = proto_kwargs.get('hostname',
                                                                     host)
            outcome.value.resultContext['port'] = port
        return outcome


    if 'debug' in proto_kwargs and proto_kwargs['debug'] == True:
        injectServer = debugCall( injectServer )

    deferredResult.addBoth(injectServer)

    return deferredResult
@Test: Generate a IPv6 address with custom (very long) prefix
dataset/ETHPy150Open OrbitzWorldwide/droned/droned/lib/droned/clients/__init__.py/connect--crossover with--dataset/ETHPy150Open omaciel/fauxfactory/tests/test_ipaddress.py/TestIpaddr.test_gen_ipv6_4