code: def plotly_sg_scraper(block, block_vars, gallery_conf, **kwargs):
      """Scrape Plotly figures for galleries of examples using
      sphinx-gallery.
  
      Examples should use ``plotly.io.show()`` to display the figure with
      the custom sphinx_gallery renderer.
  
      Since the sphinx_gallery renderer generates both html and static png
      files, we simply crawl these files and give them the appropriate path.
  
      Parameters
      ----------
      block : tuple
          A tuple containing the (label, content, line_number) of the block.
      block_vars : dict
          Dict of block variables.
      gallery_conf : dict
          Contains the configuration of Sphinx-Gallery
      **kwargs : dict
          Additional keyword arguments to pass to
          :meth:`~matplotlib.figure.Figure.savefig`, e.g. ``format='svg'``.
          The ``format`` kwarg in particular is used to set the file extension
          of the output file (currently only 'png' and 'svg' are supported).
  
      Returns
      -------
      rst : str
          The ReSTructuredText that will be rendered to HTML containing
          the images.
  
      Notes
      -----
      Add this function to the image scrapers
      """
      examples_dir = os.path.dirname(block_vars["src_file"])
      pngs = sorted(glob(os.path.join(examples_dir, "*.png")))
      htmls = sorted(glob(os.path.join(examples_dir, "*.html")))
      image_path_iterator = block_vars["image_path_iterator"]
      image_names = list()
      seen = set()
      for html, png in zip(htmls, pngs):
          if png not in seen:
              seen |= set(png)
              this_image_path_png = next(image_path_iterator)
              this_image_path_html = (
                  os.path.splitext(this_image_path_png)[0] + ".html"
              )
              image_names.append(this_image_path_html)
              shutil.move(png, this_image_path_png)
              shutil.move(html, this_image_path_html)
      # Use the `figure_rst` helper function to generate rST for image files
      return figure_rst(image_names, gallery_conf["src_dir"])
  
imports: import inspect, os
  import plotly
  from glob import glob
  import shutil
label_desc: Use image node_id 1 for calling a global function with example usage: plotly_sg_scraper(block, block_vars, gallery_conf) and returns: figure_rst