code: def interpolate_colors(colors, flat=False, num_colors=256):
      
  
      palette = []
  
      for i in range(num_colors):
          index = (i * (len(colors) - 1)) / (num_colors - 1.0)
          index_int = int(index)
          alpha = index - float(index_int)
  
          if alpha > 0:
              r = (1.0 - alpha) * colors[index_int][
                  0] + alpha * colors[index_int + 1][0]
              g = (1.0 - alpha) * colors[index_int][
                  1] + alpha * colors[index_int + 1][1]
              b = (1.0 - alpha) * colors[index_int][
                  2] + alpha * colors[index_int + 1][2]
          else:
              r = (1.0 - alpha) * colors[index_int][0]
              g = (1.0 - alpha) * colors[index_int][1]
              b = (1.0 - alpha) * colors[index_int][2]
  
          if flat:
              palette.extend((int(r), int(g), int(b)))
          else:
              palette.append((int(r), int(g), int(b)))
  
      return palette
docs: Given a list of colors, create a larger list of colors interpolating
      the first one. If flatten is True a list of numers will be returned. If
      False, a list of (r,g,b) tuples. num_colors is the number of colors wanted
      in the final list