def METHOD_NAME(data: bytes) -> dict:
    """Load JSON or Pickle into a dict"""
    try:
        config = json.loads(data.decode("utf-8"), object_hook=decode_dict)
        # remove this debugging tool after transition
        config["serialization_format"] = "json"
        return config
    except ValueError as e1:
        try:
            # first byte in a Pickle must be part of
            # OPCODE Proto == \x80 == 128
            # https://github.com/python/cpython/blob/1b293b60067f6f4a95984d064ce0f6b6d34c1216/Lib/pickletools.py#L2124
            if data[0] != 128:
                raise ValueError("Decryption error")
            config = pickle.loads(data, encoding="bytes")
            # remove this debugging tool after transition
            config["serialization_format"] = "pickle"
            return config
        except pickle.UnpicklingError as e2:
            raise ValueError(f"{e1}\n{e2}")