from typing import Dict
from typing import AnyStr
import json


def _decode_json_dict(json_dict: Dict[bytes, AnyStr]) -> dict:
    """
    Decode a dict coming from hgetall/hmget, which is encoded with bytes as keys
    and bytes or str as values, containing JSON values.
    """
    return {k.decode(): json.loads(v) for k, v in json_dict.items()}