Nest with-statements

Support for Python 2.6
Change dict comprehensions to constructor calls

Support for Python 2.6