Sample code for Python networking and threading