folding added for python