code: def solution(swarm):
      
      best = swarm[0]
      cmp = comparator(best.best_fitness)
      for particle in swarm:
          if cmp(particle.best_fitness, best.best_fitness):
              best = particle
      return best
docs: Determines the global best particle in the swarm.
  
      Args:
          swarm: iterable: an iterable that yields all particles in the swarm.
  
      Returns:
          cipy.algorithms.pso.Particle: The best particle in the swarm when
          comparing the best_fitness values of the particles.