def extract_comparator_expr(comparative_step):
    """Extract comparator and numeric expression
     of a comparative QDMR step

 Parameters
 ----------
 comparative_step : str
     string of the QDMR comparative step

 Returns
 -------
 str
     returns string representation of the comparator expression
 """
    comparator = None
    if 'at least' in comparative_step:
        comparator = '>='
    elif 'at most' in comparative_step:
        comparator = '=<'
    elif ('more' in comparative_step) or \
            ('higher' in comparative_step) or ('larger' in comparative_step):
        comparator = '>'
    elif ('less' in comparative_step) or \
            ('smaller' in comparative_step) or ('lower' in comparative_step):
        comparator = '<'
    elif ('not ' in comparative_step) and (('same as' in comparative_step) or \
                                           ('equal' in comparative_step) or ('is' in comparative_step) or \
                                           ('was' in comparative_step) or ('are' in comparative_step)):
        comparator = '!='
    elif ('not ' not in comparative_step) and (('same as' in comparative_step) or \
                                               ('equal' in comparative_step) or ('is' in comparative_step) or \
                                               ('was' in comparative_step) or ('are' in comparative_step)) and \
            ('any' not in comparative_step):
        comparator = '='
    elif ('contain' in comparative_step):
        comparator = 'CONTAINS'
    else:
        comparator = 'FILTER'
    return comparator