def truncate_year(dt, measure):
 return date(((dt.year // measure) * measure), 1, 1)

def truncate_year ( dt , measure ) : return date ( ( ( dt . year // measure ) * measure ) , 1 , 1 )
truncate by years .