python code for reverse the lines of a file