Python Folding and Hacks