Functional-style recursive pattern matching in Python. Crazy stuff.