Code from the book "Grayhat Python"