Code from the weekly Crucial Python jaminars.  http://labrosa.ee.columbia.edu/crucialpython/