PEP8: tab to spaces
import optimization
various fixes of Python code style