This is a quick reference implementation of some ideas from a discussion on the python-ideas maillist. It is fairly full-featured, but not complete or well tested yet, and probably needs some tweaking and sorting out of corner-cases.
This module is not recommended for general use.