code: def validate_colorscale(colorscale):
      """Validate the structure, scale values and colors of colorscale."""
      if not isinstance(colorscale, list):
          # TODO Write tests for these exceptions
          raise exceptions.PlotlyError(
              "A valid colorscale must be a list."
          )
      if not all(
          isinstance(innerlist, list) for innerlist in colorscale
      ):
          raise exceptions.PlotlyError(
              "A valid colorscale must be a list of lists."
          )
      colorscale_colors = colorscale_to_colors(colorscale)
      scale_values = colorscale_to_scale(colorscale)
  
      validate_scale_values(scale_values)
      validate_colors(colorscale_colors)
  
imports: import decimal
  from numbers import Number
  from _plotly_utils import exceptions
  from .None import qualitative, sequential, diverging, cyclical, cmocean, colorbrewer, carto, plotlyjs
label_desc: Use image node_id 7 for calling a global function with example usage: validate_colorscale(colorscale) without return types