code: def _dmtx_to_svg_url(design_matrices):
      """Accept a FirstLevelModel or SecondLevelModel object \
      with fitted design matrices & generate SVG Image URL, \
      which can be inserted into an HTML template.
  
      Parameters
      ----------
      design_matrices : List[pd.Dataframe]
          Design matrices computed in the model.
  
      Returns
      -------
      svg_url_design_matrices : String
          SVG Image URL for the plotted design matrices.
  
      """
      html_design_matrices = []
      dmtx_template_path = os.path.join(
          HTML_TEMPLATE_ROOT_PATH, "design_matrix_template.html"
      )
      with open(dmtx_template_path) as html_template_obj:
          dmtx_template_text = html_template_obj.read()
  
      for dmtx_count, design_matrix in enumerate(
          design_matrices, start=1
      ):
          dmtx_text_ = string.Template(dmtx_template_text)
          dmtx_plot = plot_design_matrix(design_matrix)
          dmtx_title = f"Run {dmtx_count}"
          plt.title(dmtx_title, y=0.987)
          dmtx_plot = _resize_plot_inches(dmtx_plot, height_change=0.3)
          url_design_matrix_svg = _plot_to_svg(dmtx_plot)
          # prevents sphinx-gallery & jupyter from scraping & inserting plots
          plt.close()
          dmtx_text_ = dmtx_text_.safe_substitute(
              {
                  "design_matrix": url_design_matrix_svg,
                  "dmtx_title": dmtx_title,
              }
          )
          html_design_matrices.append(dmtx_text_)
      svg_url_design_matrices = "".join(html_design_matrices)
      return svg_url_design_matrices
  
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 9 for calling a global function with example usage: _dmtx_to_svg_url(design_matrices) and returns: svg_url_design_matrices