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

    Quarters run from 1 January to 31 March, 1 April to 30 June, 
    1 July to 30 September and 1 October to 31 December.

    Parameters
    ----------
    date : datetime.date
        the date from which to determine the quarter
    base : int, optional
        the index of the first trimester (default is 1)

    Returns
    -------
    int
        quarter's index

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

    >>> quarter(datetime.date(2020, 1, 10), base=0)
    0

    See also
    --------
    semester, trimester
    """
    return (date.month - 1) // 3 + base