code: def connection_info():
      """
      Return a string showing the figure and connection status for the backend.
  
      This is intended as a diagnostic tool, and not for general use.
      """
      result = [
          "{fig} - {socket}".format(
              fig=(
                  manager.canvas.figure.get_label()
                  or f"Figure {manager.num}"
              ),
              socket=manager.web_sockets,
          )
          for manager in Gcf.get_all_fig_managers()
      ]
      if not is_interactive():
          result.append(f"Figures pending show: {len(Gcf.figs)}")
      return "\n".join(result)
  
imports: from base64 import b64encode
  import io
  import json
  import pathlib
  import uuid
  from ipykernel.comm import Comm
  from IPython.display import display, Javascript, HTML
  from matplotlib import is_interactive
  from matplotlib._pylab_helpers import Gcf
  from matplotlib.backend_bases import _Backend, CloseEvent, NavigationToolbar2
  from .backend_webagg_core import FigureCanvasWebAggCore, FigureManagerWebAgg, NavigationToolbar2WebAgg
  from .backend_webagg_core import TimerTornado, TimerAsyncio
label_desc: Use image node_id 1 for calling a global function with example usage: connection_info() and returns: str