code: def decode4js(obj):
      """Return decoded Python object from encoded object."""
      if not isinstance(obj, dict):
          return obj
      out = obj
      classname = obj.pop("__class__", None)
      if classname is None and isinstance(obj, dict):
          classname = "dict"
      if classname is None:
          return obj
      if classname == "Complex":
          out = obj["value"][0] + 1j * obj["value"][1]
      elif classname in ("List", "Tuple"):
          out = []
          for item in obj["value"]:
              out.append(decode4js(item))
          if classname == "Tuple":
              out = tuple(out)
      elif classname == "NDArray":
          if obj["__dtype__"].startswith("complex"):
              re = np.fromiter(obj["value"][0], dtype="double")
              im = np.fromiter(obj["value"][1], dtype="double")
              out = re + 1j * im
          elif obj["__dtype__"].startswith("object"):
              val = [decode4js(v) for v in obj["value"]]
              out = np.array(val, dtype=obj["__dtype__"])
          else:
              out = np.fromiter(obj["value"], dtype=obj["__dtype__"])
          out.shape = obj["__shape__"]
      elif classname == "PDataFrame" and read_json is not None:
          out = read_json(StringIO(obj["value"]))
      elif classname == "PSeries" and read_json is not None:
          out = read_json(StringIO(obj["value"]), typ="series")
      elif classname == "UFloat":
          out = uncertainties.ufloat(obj["val"], obj["err"])
      elif classname == "Callable":
          out = obj["__name__"]
          try:
              out = import_from(obj["importer"], out)
              unpacked = True
          except (ImportError, AttributeError):
              unpacked = False
          if not unpacked and HAS_DILL:
              try:
                  out = dill.loads(b64decode(obj["value"]))
              except RuntimeError:
                  msg = "Could not unpack dill-encoded callable `{0}`, saved with Python version {1}"
                  warnings.warn(
                      msg.format(obj["__name__"], obj["pyversion"])
                  )
  
      elif classname in ("Dict", "dict"):
          out = {}
          for key, val in obj.items():
              out[key] = decode4js(val)
      return out
  
file_path: lmfit-py/lmfit/jsonutils.py
imports: from base64 import b64decode, b64encode
  from io import StringIO
  import sys
  import warnings
  import numpy
  import uncertainties
label_desc: Use image node_id 4 for calling a global function with example usage: decode4js(obj) and returns: out, obj, obj