Exploring pattern matching in Python