def localSslFixup(host, sslContext):
 if ((not sslContext) and (host in ['localhost', '127.0.0.1', '::1'])):
  import ssl
  if hasattr(ssl, '_create_unverified_context'):
   sslContext = ssl._create_unverified_context()
 return sslContext

def localSslFixup ( host , sslContext ) : if ( ( not sslContext ) and ( host in [ 'localhost' , '127.0.0.1' , '::1' ] ) ) : import ssl if hasattr ( ssl , '_create_unverified_context' ) : sslContext = ssl . _create_unverified_context ( ) return sslContext
connections to localhost do not need ssl verification as a certificate will never match .