class_docstr: This is a custom encoder that converts a dictionary to
  correct json format for ingesting in cereal.
  Eg:
  dict({
    vec_state: 1,
    n_rows: 2,
    n_cols: 1,
    elem: [1,2]
  })
  
  will be converted into
  
  str({
    vec_state: 1,
    n_rows: 2,
    n_cols: 1,
    elem: 1,
    elem: 2
  })
  while encoding.
  This is used to create a json that can be ingested to cereal.
code: def encode(self, o):
      if isinstance(o, dict):
          if "elem" in o.keys():
              to_return = "{%s" % ", ".join(
                  ": ".join(
                      (
                          json.encoder.py_encode_basestring(k),
                          self.encode(v),
                      )
                  )
                  for k, v in o.items()
                  if k != "elem"
              )
              for val in o["elem"]:
                  to_return += (
                      ", "
                      + json.encoder.py_encode_basestring("elem")
                      + f": {val}"
                  )
              to_return += "}"
              return to_return
          else:
              to_return = "{%s}" % ", ".join(
                  ": ".join(
                      (
                          json.encoder.py_encode_basestring(k),
                          self.encode(v),
                      )
                  )
                  for k, v in o.items()
              )
              return to_return
      if isinstance(o, list):
          to_return = "[%s]" % ", ".join((self.encode(k) for k in o))
          return to_return
      return super().encode(o)
  
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 1 for calling the restore_value obj's underlying member method code with example usage: obj.encode(o) and returns: super, to_return, to_return, to_return