pyterm: made python compatible with python2 and python3

In python 3 there is no implicit converion of bytes to str or character.