Replaced `and...or...` constructs with PEP 308 conditional expressions.