This is the code from my original [Building Decision Trees in Python][1] article on O'Reilly.