<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def comparator(objective):
 """ 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: """


    if isinstance(objective, Minimum):
        return lambda l, r: l < r
    else:
        return lambda l, r: l > r