python write json to file formatted