def do_op(field, op, value):
    ''' used for comparisons '''
    if op==NOOP:
        return True
    if field==None:
        if value==None:
            return True
        else:
            return False
    if value==None:
        return False
    if op==LESS:
        return (field < value)
    if op==LESSorEQUAL:
        return (field <= value)
    if op==GREATERorEQUAL:
        return (field >= value)
    if op==GREATER:
        return (field > value)
    # for the EQUAL and NOT_EQUAL conditions, additional factors are considered.
    # for EQUAL,
    #    if they don't match AND the types don't match,
    #    then the STR of the field and value is also tried
    if op==EQUAL:
        if (field == value):
            return True
        if type(field)==type(value):
            return False
        try:
            field = str(field)
            value = str(value)
            return (field == value)
        except:
            return False
    # for NOT_EQUAL,
    #    if they match, then report False
    #    if they don't match AND the types don't match,
    #       then the STR equivalents are also tried.
    if op==NOT_EQUAL:
        if (field == value):
            return False
        if type(field)==type(value):
            return True
        try:
            field = str(field)
            value = str(value)
            return (field != value)
        except:
            return True
    return False
used for comparisons