def _selectVerifyImplementation():
    """
    Determine if C{service_identity} is installed. If so, use it. If not, use
    simplistic and incorrect checking as implemented in
    L{simpleVerifyHostname}.

    @return: 2-tuple of (C{verify_hostname}, C{VerificationError})
    @rtype: L{tuple}
    """

    whatsWrong = (
        "Without the service_identity module, Twisted can perform only "
        "rudimentary TLS client hostname verification.  Many valid "
        "certificate/hostname mappings may be rejected."
    )

    try:
        from service_identity import VerificationError
        from service_identity.pyopenssl import (
            verify_hostname, verify_ip_address
        )
        return verify_hostname, verify_ip_address, VerificationError
    except ImportError as e:
        warnings.warn_explicit(
            "You do not have a working installation of the "
            "service_identity module: '" + str(e) + "'.  "
            "Please install it from "
            "<https://pypi.python.org/pypi/service_identity> and make "
            "sure all of its dependencies are satisfied.  "
            + whatsWrong,
            # Unfortunately the lineno is required.
            category=UserWarning, filename="", lineno=0)

    return simpleVerifyHostname, simpleVerifyIPAddress, SimpleVerificationError

    Determine if C{service_identity} is installed. If so, use it. If not, use
    simplistic and incorrect checking as implemented in
    L{simpleVerifyHostname}.

    @return: 2-tuple of (C{verify_hostname}, C{VerificationError})
    @rtype: L{tuple}
    
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/_sslverify.py