code: def polygon_generator(data, scale, style, permutation=None):
      
  
      # We'll project the coordinates inside this function to prevent
      # passing around permutation more than necessary
      project = functools.partial(project_point, permutation=permutation)
  
      if isinstance(data, dict):
          data_gen = data.items()
      else:
          # Only works with style == 'h'
          data_gen = data
  
      for key, value in data_gen:
          if value is None:
              continue
          i = key[0]
          j = key[1]
          k = scale - i - j
          if style == 'h':
              vertices = hexagon_coordinates(i, j, k)
              yield (map(project, vertices), value)
          elif style == 'd':
              # Upright triangles
              if (i <= scale) and (j <= scale) and (k >= 0):
                  vertices = triangle_coordinates(i, j, k)
                  yield (map(project, vertices), value)
              # Upside-down triangles
              if (i < scale) and (j < scale) and (k >= 1):
                  vertices = alt_triangle_coordinates(i, j, k)
                  value = blend_value(data, i, j, k)
                  yield (map(project, vertices), value)
          elif style == 't':
              # Upright triangles
              if (i < scale) and (j < scale) and (k > 0):
                  vertices = triangle_coordinates(i, j, k)
                  value = blend_value(data, i, j, k)
                  yield (map(project, vertices), value)
              # If not on the boundary add the upside-down triangle
              if (i < scale) and (j < scale) and (k > 1):
                  vertices = alt_triangle_coordinates(i, j, k)
                  value = alt_blend_value(data, i, j, k)
                  yield (map(project, vertices), value)
docs: Generator for the vertices of the polygon to be colored and its color,
      depending on style. Called by heatmap.