It's a bit less documented than the rest of the code, but it's still an OK example.
Return statements all over the place... while 1 loops... uurgh
This code reassures me about the fact that I still hate python. Doesn't help you doing what you want at all. Instead, it says "Yeah you can do that, you can write anything anyway, I don't care". Furthermore, horrible readability (guess where 5-nested loops/conditions finish when you can only rely on indentation... Okay that's uncommon)
Apart from that, pretty decent.