code: def dump2fileobj(obj, fileobj, **kwargs):
      """Dump a JSON-serializable objects into a file-like
  
      Parameters
      ----------
      obj : object
        Structure to serialize.
      fileobj : file
        Writeable file-like object to dump into.
      **kwargs
        Keyword arguments to be passed on to simplejson.dump()
      """
      return json.dump(
          obj, codecs.getwriter("utf-8")(fileobj), **kwargs
      )
  
file_path: datalad/datalad/support/json_py.py
imports: import io
  import codecs
  from os.path import dirname, exists, lexists
  from os import makedirs
  import os
  import os.path
  import json
  from datalad.support.exceptions import CapturedException
  from ..log import lgr
label_desc: Use image node_id 2 for calling a global function with example usage: dump2fileobj(obj, fileobj) and returns: json