mport socketprint socket.gethostbyname('localhost') # result from hosts fileprint socket.gethostbyname('google.com') # your os sends out a dns query