code: def test_pytree_serialize_bad_protocol(self):
      import json
  
      Point = namedtuple("Point", ["x", "y"])
      spec = py_pytree.TreeSpec(
          namedtuple,
          Point,
          [py_pytree.LeafSpec(), py_pytree.LeafSpec()],
      )
  
      with self.assertRaisesRegex(ValueError, "Unknown protocol"):
          py_pytree.treespec_dumps(spec, -1)
  
      serialized_spec = py_pytree.treespec_dumps(spec)
      protocol, data = json.loads(serialized_spec)
      bad_protocol_serialized_spec = json.dumps((-1, data))
  
      with self.assertRaisesRegex(ValueError, "Unknown protocol"):
          py_pytree.treespec_loads(bad_protocol_serialized_spec)
  
imports: import inspect
  import re
  import unittest
  from collections import defaultdict, deque, namedtuple, OrderedDict, UserDict
  import torch
  import torch.utils._pytree
  from torch.testing._internal.common_utils import instantiate_parametrized_tests, IS_FBCODE, parametrize, run_tests, subtest, TEST_WITH_TORCHDYNAMO, TestCase
label_desc: Use image node_id 11 for calling the TestPythonPytree obj's underlying member method code with example usage: obj.test_pytree_serialize_bad_protocol() without return types