code: def date_from_quarter(base_date, ordinal, year):
      
      interval = 3
      month_start = interval * (ordinal - 1)
      if month_start < 0:
          month_start = 9
      month_end = month_start + interval
      if month_start == 0:
          month_start = 1
      return [
          datetime(year, month_start, 1),
          datetime(year, month_end, calendar.monthrange(year, month_end)[1])
      ]
docs: Extract date from quarter of a year