reformat python snippet