def get_first_day(dt, d_years=0, d_months=0):
 dt = getdate(dt)
 (overflow_years, month) = divmod(((dt.month + d_months) - 1), 12)
 year = ((dt.year + d_years) + overflow_years)
 return datetime.date(year, (month + 1), 1)

def get_first_day ( dt , d_years = 0 , d_months = 0 ) : dt = getdate ( dt ) ( overflow_years , month ) = divmod ( ( ( dt . month + d_months ) - 1 ) , 12 ) year = ( ( dt . year + d_years ) + overflow_years ) return datetime . date ( year , ( month + 1 ) , 1 )
returns the first day of the month for the date specified by date object also adds d_years and d_months if specified .