code: def create_updater(node_map, from_ver, to_ver):
      """Create an updater to update json loaded data.
  
      Parameters
      ----------
      node_map : Map[str, Function]
          Map from type_key to updating function
  
      from_ver : str
          Prefix of version that we can accept,
  
      to_ver : str
          The target version.
  
      Returns
      -------
      fupdater : function
          The updater function
      """
  
      def _updater(data):
          assert data["attrs"]["tvm_version"].startswith(from_ver)
          nodes = data["nodes"]
          for idx, item in enumerate(nodes):
              f = node_map.get(item["type_key"], None)
              if isinstance(f, list):
                  for fpass in f:
                      item = fpass(item, nodes)
              elif f:
                  item = f(item, nodes)
              nodes[idx] = item
          data["attrs"]["tvm_version"] = to_ver
          return data
  
      return _updater
  
file_path: tvm/python/tvm/ir/json_compact.py
imports: import json
  import tvm.ir
  import tvm.runtime
label_desc: Use image node_id 1 for calling a global function with example usage: create_updater(node_map, from_ver, to_ver) and returns: _updater, data