code: def color_array_by_value(value, palette, denom, mask_zeros):
      
      if value == -1:  # sentinel value
          return -1
  
      if value == 0 and mask_zeros:  # This value is masked
          if type(palette) is list:
              return (1, 1, 1)
          return (1, 1, 1, 1)
  
      if type(palette) is list:  # This is a palette
          return palette[value]
  
      # This is continuous data so the palette is actually a colormap
      return palette(float(value)/float(denom))
docs: Figure out the appropriate RGB or RGBA color for the given numerical
      value based on the palette, denom, and whether zeros should be masked.