Python Code For Nested If Formula