How to read and write Sequential data gracefully in Python