import socket
import ssl
packet, reply = '<packet>SOME_DATA</packet>', ''
HOST, PORT = 'XX.XX.XX.XX', 4434
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(10)
wrappedSocket = ssl.wrap_socket(sock, ssl_version=ssl.PROTOCOL_TLSv1,
    ciphers='ADH-AES256-SHA')
wrappedSocket.connect((HOST, PORT))
wrappedSocket.send(packet)
print(wrappedSocket.recv(1280))
wrappedSocket.close()
Открытие соединения сокета SSL в Python