http://paste.pocoo.org/show/449029/
As mentioned in the paste:
Please note that this is hacked Python SimpleFold. I don't know how much of the original plugin the code share (as I hacked it loooong ago). Do remember that it doesn't always work (but always do with my company's coding conventiens; hear I have no intent to make it work for others). Also, there is probably some useless crap laying around.
Edit: Judging by my English, I'm really tired. I leave it as-is for posterity and because it's the way it is in the paste.