Use `sys.stdout.encoding` for outputs if python 3 used