def yearsago(years, from_date=None):
    if from_date is None:
        from_date = datetime.now()
try:
    return from_date.replace(year=from_date.year - years)
except ValueError:
    assert from_date.month == 2 and from_date.day == 29
return from_date.replace(month=2, day=28, year=from_date.year - years)
Временная дельта Python в годах