def METHOD_NAME(ob):
    "convert dict from msgpack.loads() with byte string keys to text string keys"
    if isinstance(ob, dict):
        od = {}
        for k, v in ob.items():
            k = maybedecode(k)
            okv = False
            if (not okv) and (k == "note"):
                try:
                    v = METHOD_NAME(mloads(v))
                    okv = True
                except:
                    pass
            if (not okv) and k in ("type", "note"):
                try:
                    v = v.decode()
                    okv = True
                except:
                    pass
            if not okv:
                v = METHOD_NAME(v)
            od[k] = v
        return od
    if isinstance(ob, list):
        return [METHOD_NAME(v) for v in ob]
    # if isinstance(ob, bytes):
    #    return base64.b64encode(ob).decode()
    return ob