x509 = M2Crypto.X509.load_cert_string(cert)
x509.get_subject().as_text()
x509 = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM, cert)
x509.get_subject().get_components()
How can I retrieve the TLS/SSL peer certificate of a remote host using python?