Python code from MIT's 600.x course. Course available online at www.edx.org