code: def _mask_to_svg(mask_img, bg_img):
      """Plot cuts of an mask image and creates SVG code of it.
  
      Parameters
      ----------
      mask_img : Niimg-like object
          See :ref:`extracting_data`.
          The mask image; it could be binary mask or an atlas or ROIs
          with integer values.
  
      bg_img : Niimg-like object
          See :ref:`extracting_data`.
          The background image that the mask will be plotted on top of.
          To turn off background image, just pass "bg_img=None".
  
      Returns
      -------
      mask_plot_svg : str
          SVG Image Data URL for the mask plot.
  
      """
      if mask_img:
          plot_roi(
              roi_img=mask_img,
              bg_img=bg_img,
              display_mode="z",
              cmap="Set1",
          )
          mask_plot_svg = _plot_to_svg(plt.gcf())
          # prevents sphinx-gallery & jupyter from scraping & inserting plots
          plt.close()
      else:
          mask_plot_svg = (
              None  # HTML image tag's alt attribute is used.
          )
      return mask_plot_svg
  
imports: import os
  import string
  import warnings
  from collections import OrderedDict
  from collections.abc import Iterable
  from html import escape
  import numpy
  import pandas
  from matplotlib import pyplot
  from nilearn.plotting import plot_glass_brain, plot_roi, plot_stat_map
  from nilearn.plotting.img_plotting import MNI152TEMPLATE
  from nilearn.plotting.matrix_plotting import plot_contrast_matrix, plot_design_matrix
  from nilearn.reporting.html_report import HTMLReport
  from .._utils import fill_doc
  from nilearn._utils import check_niimg
  from nilearn.maskers import NiftiMasker
  from nilearn.reporting.get_clusters_table import get_clusters_table
  from nilearn.reporting.utils import figure_to_svg_quoted
label_desc: Use image node_id 11 for calling a global function with example usage: _mask_to_svg(mask_img, bg_img) and returns: mask_plot_svg