Add proper python folding support