remove file=sys.stdout from regular prints and fix them for python2
fix pathname2url import from urllib to work in python 2 and 3
add missing newline (pep8)
rework metaclass handling for singleton type to work with python 2 and 3