Do not mix tabs and spaces in the same block.

The codebase mixes spaces and tabs in the Python code. PEP8 recommends spaces.

I've only fixed those lines which mixed tabs and spaces in the same block, since those lead to syntax errors by the Python parser.