Writing to a File in python