def quarter(date, *, base=1):
    """
    Returns the quarter index of the given date

    Examples
    ------------
    >>> quarter(datetime.date(2020, 1, 10))
    1

    >>> quarter(datetime.date(2020, 1, 10), base=0)
    0
    """
    return (date.month - 1) // 3 + base
