code: def test_traverse_nested_list(self) -> None:
      state_dict = {
          "key1": [
              torch.tensor([1]),
              [33, torch.tensor([2]), [44, 55]],
              [66, 77],
          ],
      }
  
      data = {}
  
      def collect_data(path, value):
          nonlocal data
          data[path] = value
  
      _traverse.traverse_state_dict(state_dict, collect_data)
  
      self.assertNotIn(("key1"), data)
  
      self.assertIn(("key1", 0), data)
      self.assertEqual(data[("key1", 0)], torch.tensor([1]))
  
      self.assertIn(("key1", 1, 0), data)
      self.assertEqual(data[("key1", 1, 0)], 33)
  
      self.assertIn(("key1", 1, 1), data)
      self.assertEqual(data[("key1", 1, 1)], torch.tensor([2]))
  
      self.assertIn(("key1", 1, 2), data)
      self.assertEqual(data[("key1", 1, 2)], [44, 55])
      self.assertNotIn(("key1", 1, 2, 0), data)
  
      self.assertIn(("key1", 2), data)
      self.assertEqual(data[("key1", 2)], [66, 77])
  
file_path: pytorch/test/distributed/checkpoint/test_traverse.py
imports: from collections import OrderedDict
  import torch
  import torch.distributed.checkpoint._traverse
  from torch.distributed.checkpoint.metadata import STATE_DICT_TYPE
  from torch.testing._internal.common_utils import run_tests, TestCase
label_desc: Use image node_id 2 for calling the TestTraverse obj's underlying member method code with example usage: obj.test_traverse_nested_list() without return types