Increase Python 3 compatibility.

* add shebangs ("#!")
* add source code encodings
* add module docstrings
* add "from __future__" imports to increase Python 3 compatibility
* use absolute imports in the settings files.