Added byte/str compatibility for python 3