(year, quarter)
return (
        datetime.datetime(year, quarter * 3 - 2, 1),
        datetime.datetime(year + quarter * 3 // 12, (quarter * 3 + 1) % 12, 1)
    )
Returns a daterange for the quarter, that ends on the _first_ of the following month..
Returns a daterange for the quarter, that ends on the _first_ of the following month..
Returns a daterange for the quarter that ends on the _first_ of the following month ..
def get_quarter_date_range(year, quarter):
    """
    Returns a daterange for the quarter, that ends on the _first_ of the following month..
    """
    assert quarter in (1, 2, 3, 4)
    return (
        datetime.datetime(year, quarter * 3 - 2, 1),
        datetime.datetime(year + quarter * 3 // 12, (quarter * 3 + 1) % 12, 1)
    )
def get_quarter_date_range ( year , quarter ) : assert quarter in ( 1 , 2 , 3 , 4 ) return ( datetime . datetime ( year , quarter * 3 - 2 , 1 ) , datetime . datetime ( year + quarter * 3 // 12 , ( quarter * 3 + 1 ) % 12 , 1 ) )