code: def textdim(s, fontname="Consolas", fontsize=11):
      fig, ax = plt.subplots(1, 1)
      t = ax.text(
          0, 0, s, fontname=fontname, fontsize=fontsize, transform=None
      )
      bb = t.get_window_extent(find_renderer(fig))
      print(s, bb.width, bb.height)
  
      # t = mpl.textpath.TextPath(xy=(0, 0), s=s, size=fontsize, prop=fontname)
      # bb = t.get_extents()
      # print(s, "new", bb)
      plt.close()
      return bb.width, bb.height
  
imports: import matplotlib
  import matplotlib.patches
  from matplotlib import pyplot
label_desc: Use image node_id 3 for calling a global function with example usage: textdim(s, fontname, fontsize) and returns: bb,  bb