[python] Efficiently finding the last line in a text file