code: def save_icon(fig, dest_dir, name, add_black_fg_color):
      if add_black_fg_color:
          # Add explicit black foreground color to monochromatic svg icons
          # so it can be replaced by backends to add dark theme support
          svg_bytes_io = BytesIO()
          fig.savefig(svg_bytes_io, format="svg")
          svg = svg_bytes_io.getvalue()
          before, sep, after = svg.rpartition(b'\nz\n"')
          svg = before + sep + b' style="fill:black;"' + after
          (dest_dir / (name + ".svg")).write_bytes(svg)
      else:
          fig.savefig(dest_dir / (name + ".svg"))
      fig.savefig(dest_dir / (name + ".pdf"))
      for dpi, suffix in [(24, ""), (48, "_large")]:
          fig.savefig(dest_dir / (name + suffix + ".png"), dpi=dpi)
  
file_path: matplotlib/tools/make_icons.py
imports: from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
  from io import BytesIO
  from pathlib import Path
  import tarfile
  import urllib.request
  import matplotlib
  import matplotlib.pyplot
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: save_icon(fig, dest_dir, name, add_black_fg_color) without return types