Nested Decision Structure In Python