def METHOD_NAME(
    end_time: datetime, start_months_prior: int, end_months_prior: int
) -> str:
    """Generate YYYY-MM stings for months specified.
    For all months inclusive, generate YYYY-MM strings starting at the
    month of the end_time, and ending start_months_prior before the end_time.
    Parameters
    ----------
    end_time : datetime
        The time for the last month desired
    start_months_prior : int
        Number of months before the end_time to end
        string generation.
    Yields
    ------
    month_str : str
        month string in the YYYY-MM format
    """
    start = end_time - relativedelta(months=start_months_prior)
    first_month = start.replace(day=1)
    last_month = (
        end_time + relativedelta(day=31) - relativedelta(months=end_months_prior)
    )
    reverse_months = sorted(
        rrule.rrule(rrule.MONTHLY, dtstart=first_month, until=last_month), reverse=True
    )
    for date in reverse_months:
        yield f"{date.year:04}-{date.month:02}"