code: def _plot_contrasts(contrasts, design_matrices):
      """Accept dict of contrasts and list of design matrices and generate \
      a dict of contrast titles & HTML for SVG Image data url \
      for corresponding contrast plot.
  
      Parameters
      ----------
      contrasts : Dict[str, np.array or str]
          Contrast information, as a dict
            {'contrast_title_1, contrast_info_1/title_1, ...}
  
      design_matrices : List[pd.Dataframe]
          Design matrices computed in the model.
  
      Returns
      -------
      contrast_plots : Dict[str, svg img]
          Dict of contrast title and svg image data url
          for corresponding contrast plot.
  
      """
      all_contrasts_plots = {}
      contrast_template_path = os.path.join(
          HTML_TEMPLATE_ROOT_PATH, "contrast_template.html"
      )
      with open(contrast_template_path) as html_template_obj:
          contrast_template_text = html_template_obj.read()
  
      for design_matrix in design_matrices:
          for contrast_name, contrast_data in contrasts.items():
              contrast_text_ = string.Template(contrast_template_text)
              contrast_plot = plot_contrast_matrix(
                  contrast_data, design_matrix, colorbar=True
              )
              contrast_plot.set_xlabel(contrast_name)
              contrast_plot.figure.set_figheight(2)
              contrast_plot.figure.set_tight_layout(True)
              url_contrast_plot_svg = _plot_to_svg(contrast_plot)
              # prevents sphinx-gallery & jupyter
              # from scraping & inserting plots
              plt.close()
              contrasts_for_subsitution = {
                  "contrast_plot": url_contrast_plot_svg,
                  "contrast_name": contrast_name,
              }
              contrast_text_ = contrast_text_.safe_substitute(
                  contrasts_for_subsitution
              )
              all_contrasts_plots[contrast_name] = contrast_text_
      return all_contrasts_plots
  
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 5 for calling a global function with example usage: _plot_contrasts(contrasts, design_matrices) and returns: all_contrasts_plots