add an abstraction for output for python 3 to encode strings