How to determine if a float is NaN in Python?