The ssl.match_hostname() function from Python 3.4. The Secure Sockets layer is only actually *secure* if you check the hostname in the certificate returned by the server to which you are connecting, and verify that it matches to hostname that you are trying to reach.