Handles missing mode in Python 3 gracefully.