code: def value_resolver(pairs):
      """
      This function converts multiple "elem" occurences to a list when
      used with json.loads().
      Eg:
      str({
        vec_state: 1,
        n_rows: 2,
        n_cols: 1,
        elem: 1,
        elem: 2
      })
  
      will be converted to
  
      dict({
        vec_state: 1,
        n_rows: 2,
        n_cols: 1,
        elem: [1,2]
      })
      This is done to handle same keys in the json while converting to python
      dictionary.
      """
      has_elem = False
      for key, val in pairs:
          if key == "elem":
              has_elem = True
              break
      if has_elem:
          val_list = [val for (key, val) in pairs if key == "elem"]
          pairs = [(key, val) for (key, val) in pairs if key != "elem"]
          pairs.append(("elem", val_list))
      return OrderedDict(pairs)
  
file_path: mlpack/src/mlpack/bindings/python/mlpack/preprocess_json_params.py
imports: import numpy
  import json
  import pprint
  from copy import deepcopy
  from collections import OrderedDict
label_desc: Use image node_id 6 for calling a global function with example usage: value_resolver(pairs) and returns: OrderedDict