code: def date_from_duration(base_date, number_as_string, unit, duration, base_time=None):
      
      # Check if query is `2 days before yesterday` or `day before yesterday`
      if base_time is not None:
          base_date = date_from_adverb(base_date, base_time)
      num = convert_string_to_number(number_as_string)
      if unit in day_variations:
          args = {'days': num}
      elif unit in minute_variations:
          args = {'minutes': num}
      elif unit in week_variations:
          args = {'weeks': num}
      elif unit in month_variations:
          args = {'days': 365 * num / 12}
      elif unit in year_variations:
          args = {'years': num}
      if duration == 'ago' or duration == 'before' or duration == 'earlier':
          if 'years' in args:
              return datetime(base_date.year - args['years'], base_date.month, base_date.day)
          return base_date - timedelta(**args)
      elif duration == 'after' or duration == 'later' or duration == 'from now':
          if 'years' in args:
              return datetime(base_date.year + args['years'], base_date.month, base_date.day)
          return base_date + timedelta(**args)
docs: Find dates from duration
      Eg: 20 days from now
      Currently does not support strings like "20 days from last monday".