code: def test_mapping(self) -> None:
      state_dict = {
          "k0": [1],
          "k2": [torch.tensor([1]), 99, [{"k3": torch.tensor(1)}]],
          "k3": ["x", 99, [{"k3": "y"}]],
      }
  
      flatten_dict, mapping = flatten_state_dict(state_dict)
      """
          flatten_dict:
          {'k0': [1], 'k2.0': tensor([1]), 'k2.1': 99, 'k2.2.0.k3': tensor(1), 'k3': ['x', 99, [{'k3': 'y'}]]}
          mapping:
          {'k0': ('k0',), 'k2.0': ('k2', 0), 'k2.1': ('k2', 1), 'k2.2.0.k3': ('k2', 2, 0, 'k3'), 'k3': ('k3',)}
          """
  
      self.assertEqual(("k0",), mapping["k0"])
      self.assertEqual(("k2", 0), mapping["k2.0"])
      self.assertEqual(("k2", 1), mapping["k2.1"])
      self.assertEqual(("k2", 2, 0, "k3"), mapping["k2.2.0.k3"])
      self.assertEqual(("k3",), mapping["k3"])
  
imports: import torch
  from torch.distributed.checkpoint._nested_dict import flatten_state_dict, unflatten_state_dict
  from torch.testing._internal.common_utils import run_tests, TestCase
label_desc: Use image node_id 2 for calling the TestFlattening obj's underlying member method code with example usage: obj.test_mapping() without return types