def months_ago(date, nb_months=<NUM_LIT:1>):
nb_years = nb_months // <NUM_LIT:12><EOL>nb_months = nb_months % <NUM_LIT:12><EOL>month_diff = date.month - nb_months<EOL>if month_diff > <NUM_LIT:0>:<EOL><INDENT>new_month = month_diff<EOL><DEDENT>else:<EOL><INDENT>new_month = <NUM_LIT:12> + month_diff<EOL>nb_years += <NUM_LIT:1><EOL><DEDENT>return date.replace(day=<NUM_LIT:1>, month=new_month, year=date.year - nb_years)<EOL>
Return the given `date` with `nb_months` substracted from it.