Standardize logging to stderr

Standardize logging to stderr to use the sys.stderr.write() which is forward compatible with Python 3. Tested via the make tests and by local execution.

Note: hacking/module_formatter.py has an unrelated local execution issue.

(First Pull Request, hope it looks right)