code: def _plot_to_svg(plot):
      """Create an SVG image as a data URL \
      from a Matplotlib Axes or Figure object.
  
      Parameters
      ----------
      plot : Matplotlib Axes or Figure object
          Contains the plot information.
  
      Returns
      -------
      url_plot_svg : String
          SVG Image Data URL.
  
      """
      try:
          return figure_to_svg_quoted(plot)
      except AttributeError:
          return figure_to_svg_quoted(plot.figure)
  
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 4 for calling a global function with example usage: _plot_to_svg(plot) and returns: figure_to_svg_quoted, figure_to_svg_quoted