Added support for python 2.5 and 2.6 with nesting