code: def _convert_figure_base64(fig):
      buff = BytesIO()
      with warnings.catch_warnings():
          warnings.simplefilter("ignore")
          fig.tight_layout()  # removes padding
      fig.savefig(buff, format="png")
      base64img = base64.b64encode(buff.getvalue()).decode("utf-8")
      return base64img
  
imports: import base64
  import warnings
  from collections import namedtuple
  from io import BytesIO
  from typing import Callable, List, Optional, Union
  from captum._utils.common import safe_div
  from captum.attr._utils import visualization
  from captum.insights.attr_vis._utils.transforms import format_transforms
label_desc: Use image node_id 1 for calling a global function with example usage: _convert_figure_base64(fig) and returns: base64img