''

def connect(self):

    sock = socket.create_connection((self.host, self.port), self.timeout)
    try:
        protocol = ssl.PROTOCOL_SSLv23
        self.sock = ssl.SSLContext(protocol).wrap_socket(sock)
    except ssl.SSLError:
        try:
            protocol = ssl.PROTOCOL_SSLv3
            self.sock = ssl.SSLContext(protocol).wrap_socket(sock)
        except ssl.SSLError:
            try:
                protocol = ssl.PROTOCOL_TLSv1
                self.sock = ssl.SSLContext(protocol).wrap_socket(sock)
            except ssl.SSLError:
                try:
                    protocol = ssl.PROTOCOL_SSLv2
                    self.sock = ssl.SSLContext(protocol).wrap_socket(sock)
                except ssl.SSLError:
                    self.sock = sock
