code: def comparator(objective):
      
  
      if isinstance(objective, Minimum):
          return lambda l, r: l < r
      else:
          return lambda l, r: l > r
docs: Higher order function creating a compare function for objectives.
  
      Args:
          objective (cipy.algorithms.core.Objective): The objective to create a
              compare for.
  
      Returns:
          callable: Function accepting two objectives to compare.
  
      Examples:
          >>> a = Minimum(0.1)
          >>> b = Minimum(0.2)
          >>> compare = comparator(a)
          >>> comparison = compare(a, b) # False