def METHOD_NAME(frequency: Frequency, start_date: datetime):
    end_date = start_date
    if frequency == Frequency.DAILY:
        end_date = end_date + timedelta(days=1)
    if frequency == Frequency.WEEKLY:
        end_date = end_date + timedelta(7 - end_date.weekday())
    if frequency == Frequency.MONTHLY:
        last_day_of_month = calendar.monthrange(start_date.year, start_date.month)[1]
        end_date = end_date.replace(day=last_day_of_month) + timedelta(days=1)
    if frequency == Frequency.YEARLY:
        end_date = end_date.replace(month=12, day=31) + timedelta(days=1)
    return end_date - timedelta(microseconds=1)