Fix dictionary compatibility issues

In python3, there is no has_keys() method for dicts anymore. Instead use
the syntax

    "key" in mydict

which is compatible to python2.
Fix binary issues

In python3 byte-arrays and strings are not implicit convertible anymore.