code: def scrub(obj, bad_key, values, full_paths, ref_path):
      """
      This function removes a certain key-value pair from the
      given dictionary.
      params:
      1) obj (dict) - dictionary to traverse.
      2) bad_key (str) - key to remove.
      3) values (list) - list of values of all occurrences of bad_key
                        (this will be used to insert bad_key back into dictionary).
      4) full_paths (list) - this is a list that contains full path to all
                             occurrences of bad_key (used to insert bad_key back
                             into dictionary).
      5) ref_path (list) - this for keeping track of the current path in the
                           dictionary.
      """
      if isinstance(obj, OrderedDict):
          for key in list(obj.keys()):
              ref_path.append(key)
              if key == bad_key:
                  ref_path.pop()
                  ref_path_copy = deepcopy(ref_path)
                  full_paths.append(ref_path_copy)
                  values.append(obj[key])
                  del obj[key]
              else:
                  scrub(obj[key], bad_key, values, full_paths, ref_path)
          if ref_path != []:
              ref_path.pop()
      elif isinstance(obj, list):
          for i in range(len(obj)):
              ref_path.append(f"listidx_{i}")
              scrub(obj[i], bad_key, values, full_paths, ref_path)
          if ref_path != []:
              ref_path.pop()
      else:
          ref_path.pop()
          pass
  
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 5 for calling a global function with example usage: scrub(obj, bad_key, values, full_paths, ref_path) without return types