<s>[INST] How to fix python indentation I have some python code that have inconsistent indentation, there is a lot of mixture of tabs and spaces to make the matter even worse even space indentation is not preserved.
The code works as expected but it's difficult to maintain.
How can I fix the indentation (like "html tidy" but for python) without breaking the code?
 [/INST] Use the reindent.py script that you find in the Tools/scripts/ directory of your Python installation:

Change Python (.py) files to use
  4-space indents and no hard tab
  characters. Also trim excess spaces
  and tabs from ends of lines, and
  remove empty lines at the end of
  files.  Also ensure the last line ends
  with a newline.

Have a look at that script for detailed usage instructions.
 </s>