human
Complete this python program:
def _setDNSCache():
assistant
#Here is the Python code you requested.

    """Makes a cached version of socket._getaddrinfo to avoid subsequent DNS requests.
    """
    def _getaddrinfo(*args, **kwargs):
        if (args in kb.cache.addrinfo):
            return kb.cache.addrinfo[args]
        else:
            kb.cache.addrinfo[args] = socket._getaddrinfo(*args, **kwargs)
            return kb.cache.addrinfo[args]
    if (not hasattr(socket, '_getaddrinfo')):
        socket._getaddrinfo = socket.getaddrinfo
        socket.getaddrinfo = _getaddrinfo