add foldmethod for python