added serialization option to python script