docs: def diversity_termination(population, num_generations, num_evaluations, args):
      """Return True if population diversity is less than a minimum diversity.
      
      This function calculates the Euclidean distance between every pair of
      individuals in the population. It then compares the maximum of those
      distances with a specified minimum required diversity. This terminator 
      is really only well-defined for candidate solutions which are list 
      types of numeric values. 
      
      .. Arguments:
         population -- the population of Individuals
         num_generations -- the number of elapsed generations
         num_evaluations -- the number of candidate solution evaluations
         args -- a dictionary of keyword arguments
      
      Optional keyword arguments in args:
      
      - *min_diversity* -- the minimum population diversity allowed (default 0.001)
      
      """
      min_diversity = args.setdefault('min_diversity', 0.001)
      cart_prod = itertools.product(population, population)
      distance = []
      for (p, q) in cart_prod:
          d = 0
          for x, y in zip(p.candidate, q.candidate):
              d += (x - y)**2
          distance.append(math.sqrt(d))
      return max(distance) < min_diversity