def getaddrinfo(self, *args, **kwargs):
        if len(args) == 2 and isinstance(args[1], (int, long)):
            try:
                socket.inet_aton(args[0])
            except socket.error:
                pass
            else:  # args is of form (ip_string, integer)
                return socket.getaddrinfo(*args)
        return super(_Resolver, self).getaddrinfo(*args, **kwargs)
See lfs.plugins.PriceCalculator
dataset/ETHPy150Open paypal/support/support/connection_mgr.py/_Resolver.getaddrinfo--crossover with--dataset/ETHPy150Open diefenbach/django-lfs/lfs/catalog/models.py/Product.get_standard_price_net