code: def validate_colors_dict(colors, colortype="tuple"):
      """
      Validates dictioanry of color(s)
      """
      # validate each color element in the dictionary
      for key in colors:
          if "rgb" in colors[key]:
              colors[key] = color_parser(colors[key], unlabel_rgb)
              for value in colors[key]:
                  if value > 255.0:
                      raise exceptions.PlotlyError(
                          "Whoops! The elements in your rgb colors "
                          "tuples cannot exceed 255.0."
                      )
              colors[key] = color_parser(
                  colors[key], unconvert_from_RGB_255
              )
  
          if "#" in colors[key]:
              colors[key] = color_parser(colors[key], hex_to_rgb)
              colors[key] = color_parser(
                  colors[key], unconvert_from_RGB_255
              )
  
          if isinstance(colors[key], tuple):
              for value in colors[key]:
                  if value > 1.0:
                      raise exceptions.PlotlyError(
                          "Whoops! The elements in your colors tuples "
                          "cannot exceed 1.0."
                      )
  
      if colortype == "rgb":
          for key in colors:
              colors[key] = color_parser(
                  colors[key], convert_to_RGB_255
              )
              colors[key] = color_parser(colors[key], label_rgb)
  
      return colors
  
imports: from __future__ import absolute_import
  import decimal
  from numbers import Number
  import six
  from _plotly_utils import exceptions
  from .None import qualitative, sequential, diverging, cyclical, cmocean, colorbrewer, carto, plotlyjs
label_desc: Use image node_id 3 for calling a global function with example usage: validate_colors_dict(colors, colortype) and returns: colors