Rule Engine In Python Code