def connect(clientId, keepalive=0, willTopic=None,
                willMessage=None, willQoS=0, willRetain=False, 
                username=None, password=None, cleanStart=True, version=mqtt.v311):
        '''
        Abstract
        ========

        Send a CONNECT control packet.

        Description
        ===========

        After a Network Connection is established by a Client to a Server, 
        the first Packet sent from the Client to the Server MUST be a CONNECT 
        Packet [MQTT-3.1.0-1].

        A Client can only send the CONNECT Packet once over a 
        Network Connection. The Server MUST process a second CONNECT Packet 
        sent from a Client as a protocol violation and disconnect the Client.

        If the Client does not receive a CONNACK Packet from the Server within
        a reasonable amount of time, he Client SHOULD close the Network 
        Connection. A "reasonable" amount of time depends on the type of 
        application and the communications infrastructure.

        Signature
        =========

        @param clientId: client ID for the connection (UTF-8 string)
        @param keepalive: connection keepalive period in seconds.
        @param willTopic:   last will topic  (UTF-8 string)
        @param willMessage: last will message  (UTF-8 string)
        @param willQoS:     last will qos message
        @param willRetain:  lass will retain flag.
        @param cleanStart:  session clean flag.
        @return: a Deferred whose callback will be called with a tuple
            C{returnCode, sessionFlag)} when the connection completes. 
            The Deferred errback with a C{MQTTError} exception will be called 
            if no connection ack is received from the server within a keepalive
            period. If no keepalive is used, a max of 10 seconds is used.
        '''
Abstract
        ========

        Send a CONNECT control packet.

        Description
        ===========

        After a Network Connection is established by a Client to a Server, 
        the first Packet sent from the Client to the Server MUST be a CONNECT 
        Packet [MQTT-3.1.0-1].

        A Client can only send the CONNECT Packet once over a 
        Network Connection. The Server MUST process a second CONNECT Packet 
        sent from a Client as a protocol violation and disconnect the Client.

        If the Client does not receive a CONNACK Packet from the Server within
        a reasonable amount of time, he Client SHOULD close the Network 
        Connection. A "reasonable" amount of time depends on the type of 
        application and the communications infrastructure.

        Signature
        =========

        @param clientId: client ID for the connection (UTF-8 string)
        @param keepalive: connection keepalive period in seconds.
        @param willTopic:   last will topic  (UTF-8 string)
        @param willMessage: last will message  (UTF-8 string)
        @param willQoS:     last will qos message
        @param willRetain:  lass will retain flag.
        @param cleanStart:  session clean flag.
        @return: a Deferred whose callback will be called with a tuple
            C{returnCode, sessionFlag)} when the connection completes. 
            The Deferred errback with a C{MQTTError} exception will be called 
            if no connection ack is received from the server within a keepalive
            period. If no keepalive is used, a max of 10 seconds is used.