Python Recipe of the Day

The following recipe is from Python Cookbook, 2nd Edition, by Alex Martelli, Anna Ravenscroft and David Ascher. All links in this recipe point to the online version of the book on the Safari Bookshelf.