code: def make_threshold_gradient(self, py3, thresholds, size=100):
  
          
          thresholds = sorted(thresholds)
          key = "{}|{}".format(thresholds, size)
          try:
              return self._gradients_cache[key]
          except KeyError:
              pass
          minimum = min(thresholds)[0]
          maximum = max(thresholds)[0]
          if maximum - minimum > size:
              steps_size = size / (maximum - minimum)
          else:
              steps_size = 1
          colors = []
          for index in range(len(thresholds) - 1):
              color_list = [thresholds[index][1], thresholds[index + 1][1]]
              num_colors = int(
                  (thresholds[index + 1][0] - thresholds[index][0]) * steps_size
              )
              colors.extend(self.generate_gradient(color_list, num_colors))
          # cache gradient
          self._gradients_cache[key] = colors
          return colors
docs: Given a thresholds list, creates a gradient list that covers the range
          of the thresholds.
          The number of colors in the gradient is limited by size.
          Because of how the range is split the exact number of colors in the
          gradient cannot be guaranteed.