patterns in python