How to determine if a float is infinite in Python?