code: def _update_template(
      title,
      docstring,
      content,
      overlay,
      parameters,
      data,
      template_name=None,
  ):
      """Populate a report with content.
  
      Parameters
      ----------
      title : str
          The title for the report.
  
      docstring : str
          The introductory docstring for the reported object.
  
      content : img
          The content to display.
  
      overlay : img
          Overlaid content, to appear on hover.
  
      parameters : dict
          A dictionary of object parameters and their values.
  
      data : dict
          A dictionary holding the data to be added to the report.
          The keys must match exactly the ones used in the template.
          The default template accepts the following:
              - description (str) : Description of the content.
              - warning_message (str) : An optional warning
                message to be displayed in red. This is used
                for example when no image was provided to the
                estimator when fitting.
          The NiftiLabelsMasker template accepts the additional
          fields:
              - summary (dict) : A summary description of the
                region labels and sizes. This will be displayed
                as an expandable table in the report.
  
      template_name : str, optional
          The name of the template to use. If not provided, the
          default template `report_body_template.html` will be
          used.
  
      Returns
      -------
      report : HTMLReport
          An instance of a populated HTML report.
  
      """
      resource_path = (
          Path(__file__).resolve().parent.joinpath("data", "html")
      )
  
      if template_name is None:
          body_template_name = "report_body_template.html"
      else:
          body_template_name = template_name
      body_template_path = resource_path.joinpath(body_template_name)
      if not os.path.exists(str(body_template_path)):
          raise FileNotFoundError(f"No template {body_template_name}")
      tpl = tempita.HTMLTemplate.from_filename(
          str(body_template_path), encoding="utf-8"
      )
      body = tpl.substitute(
          title=title,
          content=content,
          overlay=overlay,
          docstring=docstring,
          parameters=parameters,
          **data,
      )
  
      head_template_name = "report_head_template.html"
      head_template_path = resource_path.joinpath(head_template_name)
      with open(str(head_template_path)) as head_file:
          head_tpl = Template(head_file.read())
  
      return HTMLReport(body=body, head_tpl=head_tpl)
  
imports: import copy
  import os
  import warnings
  from pathlib import Path
  from string import Template
  from nilearn.externals import tempita
  from nilearn.plotting.html_document import HTMLDocument
  from nilearn.reporting.utils import figure_to_svg_base64
label_desc: Use image node_id 4 for calling a global function with example usage: _update_template(title, docstring, content, overlay, parameters, data, template_name) and returns: HTMLReport