Pattern matching for Python