In emacs, M-x tabify
will convert spaces to tabs where possible. You'll probably want to set the tab-width
variable appropriately.
I don't know if this addresses your concern that spaces be interpreted in the same way as the python interpreter, but you could always load up python-mode and use M-x indent-region
.