def make_colorscale(colors, scale=None):
 colorscale = []
 if (len(colors) < 2):
  raise exceptions.PlotlyError('You must input a list of colors that has at least two colors.')
 if (scale is None):
  scale_incr = (1.0 / (len(colors) - 1))
  return [[(i * scale_incr), color] for (i, color) in enumerate(colors)]
 else:
  if (len(colors) != len(scale)):
   raise exceptions.PlotlyError('The length of colors and scale must be the same.')
  validate_scale_values(scale)
  colorscale = [list(tup) for tup in zip(scale, colors)]
  return colorscale

def make_colorscale ( colors , scale = None ) : colorscale = [ ] if ( len ( colors ) < 2 ) : raise exceptions . PlotlyError ( 'You must input a list of colors that has at least two colors.' ) if ( scale is None ) : scale_incr = ( 1.0 / ( len ( colors ) - 1 ) ) return [ [ ( i * scale_incr ) , color ] for ( i , color ) in enumerate ( colors ) ] else : if ( len ( colors ) != len ( scale ) ) : raise exceptions . PlotlyError ( 'The length of colors and scale must be the same.' ) validate_scale_values ( scale ) colorscale = [ list ( tup ) for tup in zip ( scale , colors ) ] return colorscale
makes a colorscale from a list of colors and a scale takes a list of colors and scales and constructs a colorscale based on the colors in sequential order .