def getResolver():
    """
    Get a Resolver instance.

    Create twisted.names.client.theResolver if it is L{None}, and then return
    that value.

    @rtype: C{IResolver}
    """
    global theResolver
    if theResolver is None:
        try:
            theResolver = createResolver()
        except ValueError:
            theResolver = createResolver(servers=[('127.0.0.1', 53)])
    return theResolver

    Get a Resolver instance.

    Create twisted.names.client.theResolver if it is L{None}, and then return
    that value.

    @rtype: C{IResolver}
    
stackoverflow/venv/lib/python3.6/site-packages/twisted/names/client.py