pyterm: made python compatible with python2 and python3

In python 3 there is no implicit converion of bytes to str or character.
Merge pull request #1349 from cgundogan/fix_pyterm_python_version

pyterm: made python compatible with python2 and python3