Sample Python code from the book A Programmer's Guide to Data Mining