my_date = date.today() - timedelta(days=days_to_substract)
next = my_date + relativedelta(weekday=MO)
previous = my_date + relativedelta(weekday=MO(-1))
print('mydate is %s' % my_date)
print('next monday is %s' % next)
print('previous monday is %s' % previous)
diff1 = my_date - previous
diff2 = next - my_date
if diff2 < diff1:
    print('Closest monday is %s' % next)
else:
    print('Closest monday is %s' % previous)
Даты округления в Python