code: def _store_result_image_json(fig, result_fn):
      import os
      import json
  
      os.makedirs(result_fn.parent, exist_ok=True)
  
      # This produces a Python dict that's JSON compatible. We print it to a
      # file in a way that is easy to diff and lists properties in a predictable
      # order
      fig_json = fig.to_dict()
      with open(result_fn, "wt") as handle:
          json.dump(fig_json, handle, indent=2, sort_keys=True)
  
file_path: python-igraph/tests/drawing/plotly/utils.py
imports: from pathlib import Path
  import sys
  import inspect
  import functools
label_desc: Use image node_id 4 for calling a global function with example usage: _store_result_image_json(fig, result_fn) without return types