def doConnect(self, request):
def connectError():<EOL><INDENT>request.deferred.errback(MQTTTimeoutError("<STR_LIT>"))<EOL>request.deferred = None<EOL>self.transport.abortConnection()            <EOL><DEDENT>try:<EOL><INDENT>self._checkConnect(request)<EOL>pdu = request.encode()<EOL><DEDENT>except ValueError as e:<EOL><INDENT>return defer.fail(e)<EOL><DEDENT>log.debug("<STR_LIT>", packet="<STR_LIT>", id=request.clientId, keepalive=request.keepalive, clean=request.cleanStart)<EOL>self._cleanStart = request.cleanStart<EOL>self._version    = request.version<EOL>self.transport.write(pdu)<EOL>self.state = self.CONNECTING<EOL>request.alarm = self.callLater(request.keepalive or <NUM_LIT:10>, connectError)<EOL>request.deferred = defer.Deferred()<EOL>self.connReq = request  <EOL>return request.deferred<EOL>
Performs the actual work of connecting