Added efficient python folding