def previous_qtr(qtr, s):
    """
    For once, a self-explanatory function name! Calculate what the previous qtr is in s['list_qtr']

    :param qtr: given qtr
    :param s: Settings dictionary
    :return: previous qtr in s['list_qtr']
    """
    idx = s['list_qtr'].index(qtr)
    if idx == 0:
        raise ValueError('[ERROR] This is the first quarter in the time_range')
    else:
        return s['list_qtr'][idx - 1]
