def init_context(cert_path=None):
 context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
 context.set_default_verify_paths()
 context.load_verify_locations(cafile=(cert_path or cert_loc))
 context.verify_mode = ssl.CERT_REQUIRED
 context.check_hostname = True
 with ignore_missing():
  context.set_npn_protocols(SUPPORTED_NPN_PROTOCOLS)
 with ignore_missing():
  context.set_alpn_protocols(SUPPORTED_NPN_PROTOCOLS)
 context.options |= ssl.OP_NO_COMPRESSION
 return context

def init_context ( cert_path = None ) : context = ssl . SSLContext ( ssl . PROTOCOL_SSLv23 ) context . set_default_verify_paths ( ) context . load_verify_locations ( cafile = ( cert_path or cert_loc ) ) context . verify_mode = ssl . CERT_REQUIRED context . check_hostname = True with ignore_missing ( ) : context . set_npn_protocols ( SUPPORTED_NPN_PROTOCOLS ) with ignore_missing ( ) : context . set_alpn_protocols ( SUPPORTED_NPN_PROTOCOLS ) context . options |= ssl . OP_NO_COMPRESSION return context
create a new sslcontext that is correctly set up for an http/2 connection .