def simpleVerifyHostname(connection, hostname):
 commonName = connection.get_peer_certificate().get_subject().commonName
 if (commonName != hostname):
  raise SimpleVerificationError(((repr(commonName) + '!=') + repr(hostname)))

def simpleVerifyHostname ( connection , hostname ) : commonName = connection . get_peer_certificate ( ) . get_subject ( ) . commonName if ( commonName != hostname ) : raise SimpleVerificationError ( ( ( repr ( commonName ) + '!=' ) + repr ( hostname ) ) )
check only the common name in the certificate presented by the peer and only for an exact match .