Looks like autopep8 can fix them for you (I use the --in-place option)