1. Open IDEA >File > Settings >
Set Tab and Indent
Set hard wrap
2. Choose your .py file > Reformat Code