The code as reprinted here won't work, because the textual layout of the code doesn't match the original. (In Python, unlike most other programming languages, layout matters.) Working code is at http://www.freedom-to-tinker.com/tinyp2p.py