>>> import socket
>>> socket.gethostbyname('google.com')
'74.125.224.198'
>>> socket.gethostbyname('foo') # no host 'foo' exists on the network
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
socket.gaierror: [Errno 8] nodename nor servname provided, or not known