There is a variety of style checkers (tools that give a feedback) and autoformatters (tools that are able to fix the formatting violations automatically).
Existing type checkers and autoformatters
Checks Python code against some of the style conventions in PEP 8.
Automatically fixes most of the formatting issues reported by pycodestyle. Since PEP 8 is rather liberal, autopep8/pycodestyle don't modify code too much.
A PEP 8 compliant opinionated autoformatter with its own style, going further than autopep8/pycodestyle. Style configuration options are deliberately limited to a minimum. Black aims for readability and reducing git diffs. Black is an easy to use tool, with sensible and useful defaults. Its style is very elegant.
Autoformatter that can be configured to support different styles.
Sorts imports alphabetically, and separates them into sections, according to their type.