This is the source code from Grey Hat Python written by Justin Seitz, along with modifications.