code: def mean_centroid(candidates):
      
      sum_x = 0.0
      sum_y = 0.0
      for centroid_x, centroid_y, _, _ in candidates:
          sum_x += centroid_x
          sum_y += centroid_y
      denom = 3.0 * len(candidates)
      return sum_x / denom, sum_y / denom
docs: Take the mean of all centroids in set of reference triangles.
  
      .. note::
  
         This is used **only** as a helper for :func:`locate_point`.
  
      Args:
          candidates (List[Tuple[float, float, float, numpy.ndarray]): List of
              4-tuples, each of which has been produced by :func:`locate_point`.
              Each 4-tuple contains
  
              * Three times centroid ``x``-value
              * Three times centroid ``y``-value
              * "Width" of a parameter space for a surface
              * Control points for a surface
  
              We only use the first two values, which are triple the desired
              value so that we can put off division by three until summing in
              our average. We don't use the other two values, they are just an
              artifact of the way ``candidates`` is constructed by the caller.
  
      Returns:
          Tuple[float, float]: The mean of all centroids.