code: def fig_to_uri(in_fig, close_all=True, **save_args):
      """
      Save a figure as a URI
      :param in_fig:
      :return:
      """
      out_img = BytesIO()
      in_fig.savefig(out_img, format="png", **save_args)
      if close_all:
          in_fig.clf()
          plt.close("all")
      out_img.seek(0)  # rewind file
      encoded = (
          base64.b64encode(out_img.read())
          .decode("ascii")
          .replace("\n", "")
      )
      return "data:image/png;base64,{}".format(encoded)
  
file_path: nlp-architect/solutions/InterpreT/application/plotFunc.py
imports: import base64
  import copy
  from io import BytesIO
  import numpy
  import matplotlib.pyplot
  import plotly.graph_objects
label_desc: Use image node_id 5 for calling a global function with example usage: fig_to_uri(in_fig, close_all) and returns: str