Changed python string formatting to python 3 syntax and changed print statements to the print function.
Added socket timeout of 20 seconds.