code: def add_months(self, datetimestr, n, return_date=False):
          
          a_datetime = self.parse_datetime(datetimestr)
          month_from_ordinary = a_datetime.year * 12 + a_datetime.month
          month_from_ordinary += n
          year, month = divmod(month_from_ordinary, 12)
          
          try:
              a_datetime = datetime(year, month, a_datetime.day,
                  a_datetime.hour, a_datetime.minute, 
                  a_datetime.second, a_datetime.microsecond)
          except ValueError:
              a_datetime = datetime(year, month+1, 1,
                  a_datetime.hour, a_datetime.minute, 
                  a_datetime.second, a_datetime.microsecond)
              a_datetime = self.add_days(a_datetime, -1)
  
          if return_date:
              return a_datetime.date()
          else:
              return a_datetime
docs: Returns a time that n months after a time.
          
          Notice: for example, the date that one month after 2015-01-31 supposed
          to be 2015-02-31. But there's no 31th in Feb, so we fix that value to 
          2015-02-28.
          
          :param datetimestr: a datetime object or a datetime str
          :param n: number of months, value can be negative
          :param return_date: returns a date object instead of datetime
          
          **中文文档**
          
          返回给定日期N月之后的时间。