code: def _embed_img(display):
      """Embed an image or just return its instance if already embedded.
  
      Parameters
      ----------
      display : obj
          A Nilearn plotting object to display.
  
      Returns
      -------
      embed : str
          Binary image string.
  
      """
      if display is None:  # no image to display
          return None
      # If already embedded, simply return as is
      if isinstance(display, str):
          return display
      return figure_to_svg_base64(display.frame_axes.figure)
  
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 2 for calling a global function with example usage: _embed_img(display) and returns: figure_to_svg_base64, None, display