def get_order_by(comparator):
    """
    Set the ORDER BY value for the query so that it makes sense
    with the comparator in combination with a LIMIT clause.
    comparator values:
        0: <
        1: <=
        2: >
        3: >=

    Example:
        100 tracks with >= 10 plays, we want to order by DESC and LIMIT 100
    """
    if comparator == 0 or comparator == 1:
        return 'ASC'
    elif comparator == 2 or comparator == 3:
        return 'DESC'
    else:
        raise Exception('Bad value for comparator')
