code: def use_dir(dirname=None):
      """context manager to temporarily change the working directory"""
      cwd = os.getcwd()
      if dirname is None:
          dirname = cwd
      os.chdir(dirname)
      yield
      os.chdir(cwd)
  
imports: import os
  import glob
  import sys
  import gc
  import traceback
  import itertools
  import json
  import contextlib
  import matplotlib
  import matplotlib.pyplot
  import mpld3
  from mpld3 import urls
  from mpld3._display import NumpyEncoder
  from mpld3.mpld3renderer import MPLD3Renderer
  from mpld3.mplexporter import Exporter
label_desc: Use image node_id 2 for calling a global function with example usage: use_dir(dirname) without return types