handler.py - add .encode; required for python3

and it seems to be available in python2 too