python code for reversing file data.