code: def png_img_html_from_pyplot_figure(fig: "Figure",
                                      dpi: int = 100,
                                      extra_html_class: str = None) -> str:
      
      if fig is None:
          return ""
      # Make a file-like object
      memfile = io.BytesIO()
      # In general, can do
      #   fig.savefig(filename/file-like-object/backend, format=...)
      # or
      #   backend.savefig(fig):
      # see e.g. http://matplotlib.org/api/backend_pdf_api.html
      fig.savefig(memfile, format="png", dpi=dpi)
      memfile.seek(0)
      pngblob = memoryview(memfile.read())
      return rnc_web.get_png_img_html(pngblob, extra_html_class)
docs: Converts a ``pyplot`` figure to an HTML IMG tag with encapsulated PNG.