sock = socket.create_connection((self.host, self.port), self.timeout, self.
    source_address)
if self._tunnel_host:
    self.sock = sock
self._tunnel()
self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file)
HTTPS session reuse in Python