How to Deal with Infinity in Python