code: def _encode(self, value, path_from_root):
          
  
          # Constructs a new `dict` tree in `json_value` that discards and/or
          # encodes objects that aren't JSON serializable.
  
          if isinstance(value, dict):
              json_value = {}
              for key, value in six.iteritems(value):
                  json_value[key] = self._encode(value, path_from_root + (key,))
              return json_value
          else:
              path = ".".join(path_from_root)
              if util.is_pandas_data_frame(value):
                  return util.encode_data_frame(path, value, self._run)
              else:
                  friendly_value, converted = util.json_friendly(data_types.val_to_json(path, value))
                  json_value, compressed = util.maybe_compress_summary(friendly_value, util.get_h5_typename(value))
                  if compressed:
                      self.write_h5(path_from_root, friendly_value)
  
                  return json_value
          """
              if isinstance(value, dict):
                  json_child[key], converted = util.json_friendly(
                      self._encode(value, path_from_root + [key]))
              else:
          """
docs: Normalize, compress, and encode sub-objects for backend storage.
  
          value: Object to encode.
          path_from_root: `tuple` of key strings from the top-level summary to the
              current `value`.
  
          Returns:
              A new tree of dict's with large objects replaced with dictionaries
              with "_type" entries that say which type the original data was.