code: def mpl_to_plotly_cmap(cmap) -> List:
      """Convert a matplotlib cmap for use with Plotly.
  
      https://plotly.com/python/v3/matplotlib-colorscales/
  
      Args:
          cmap: The matplotlib colormap
  
      Returns:
          Plotly colorscale
      """
      pl_rgb = []
      norm = Normalize(vmin=0, vmax=255)
      for i in range(0, 255):
          k = colorConverter.to_rgb(cmap(norm(i)))
          pl_rgb.append(k)
      pl_entries = 255
      h = 1.0 / (pl_entries - 1)
      pl_colorscale = []
      for k in range(pl_entries):
          C = list(map(np.uint8, np.array(cmap(k * h)[:3]) * 255))
          pl_colorscale.append([k * h, "rgb" + str((C[0], C[1], C[2]))])
      return pl_colorscale
  
imports: from typing import List
  import numpy
  from matplotlib.colors import LinearSegmentedColormap, Normalize
  from matplotlib.colors import colorConverter
label_desc: Use image node_id 2 for calling a global function with example usage: mpl_to_plotly_cmap(cmap) and returns: pl_colorscale