python code for text file to reformat