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.
How is coding style related to Python, which is a multi-paradigm language ?
It looks like you invest too much energy into hating, instead of reading at least a beginner tutorial
If you think Python is madness, you didn't see Haskell or Clean yet.
This code is obviously is not about maintainability or handling extrem cases, it just solves the problem.