DNS resolver script in Python