def override_system_resolver(resolver=None):
 if (resolver is None):
  resolver = get_default_resolver()
 global _resolver
 _resolver = resolver
 socket.getaddrinfo = _getaddrinfo
 socket.getnameinfo = _getnameinfo
 socket.getfqdn = _getfqdn
 socket.gethostbyname = _gethostbyname
 socket.gethostbyname_ex = _gethostbyname_ex
 socket.gethostbyaddr = _gethostbyaddr

def override_system_resolver ( resolver = None ) : if ( resolver is None ) : resolver = get_default_resolver ( ) global _resolver _resolver = resolver socket . getaddrinfo = _getaddrinfo socket . getnameinfo = _getnameinfo socket . getfqdn = _getfqdn socket . gethostbyname = _gethostbyname socket . gethostbyname_ex = _gethostbyname_ex socket . gethostbyaddr = _gethostbyaddr
override the system resolver routines in the socket module with versions which use dnspythons resolver .