()
Makes a cached version of socket._getaddrinfo to avoid subsequent DNS requests.
Makes a cached version of socket._getaddrinfo to avoid subsequent DNS requests.
Makes a cached version of socket . _getaddrinfo to avoid subsequent DNS requests .
def _setDNSCache():
    """
    Makes a cached version of socket._getaddrinfo to avoid subsequent DNS requests.
    """

    def _getaddrinfo(*args, **kwargs):
        if args in kb.cache:
            return kb.cache[args]

        else:
            kb.cache[args] = socket._getaddrinfo(*args, **kwargs)
            return kb.cache[args]

    if not hasattr(socket, '_getaddrinfo'):
        socket._getaddrinfo = socket.getaddrinfo
        socket.getaddrinfo = _getaddrinfo
def _setDNSCache ( ) : def _getaddrinfo ( * args , * * kwargs ) : if args in kb . cache : return kb . cache [ args ] else : kb . cache [ args ] = socket . _getaddrinfo ( * args , * * kwargs ) return kb . cache [ args ] if not hasattr ( socket , '_getaddrinfo' ) : socket . _getaddrinfo = socket . getaddrinfo socket . getaddrinfo = _getaddrinfo