How To Apply Nested If In Python