def METHOD_NAME(
    series: pd.Series, max_days_to_spread: int = 14, is_multiindex: bool = False
) -> pd.Series:
    """Spreads first reported value after reported zeros by dividing it evenly
    over the prior days.
    Args:
        series: Series of new cases with date index.
        max_days_to_spread: Maximum number of days to spread a single report. If
            a stall exceeds this number of days, the reported value will be spread
            over max_days_to_spread and the remaining zeros will be kept as
            zeros.
        is_multiindex: Whether or not the series contains a multi-level index. If
            true, one level must be a date index.
    """
    if not (series > 0).any():
        return series
    # Remove NaN values from backfill calculations.
    # We will re-add the NaN indices at the end,
    # this way NaN values do not have cases spread to them and they do not reset stalled_days_count.
    # NaNs are created from data blocked through manual region overrides and outlier detection.
    empty_dates = series[series.isna()]
    series = series.dropna()
    # Counting consecutive zeros
    zeros = series == 0
    zeros_count = zeros.cumsum()
    stalled_days_count = zeros_count.sub(zeros_count.mask(zeros).ffill().fillna(0))
    # Add one more day for spreading on first report after zeros
    first_report_after_zeros = (series != 0) & (series.shift(1) == 0)
    stalled_days_count = stalled_days_count + (
        (stalled_days_count.shift(1).fillna(0) + 1) * first_report_after_zeros
    )
    num_days_worth_of_cases = stalled_days_count * first_report_after_zeros
    # Backfill number of days to spread to preceding zeros
    temp = num_days_worth_of_cases.copy()
    temp[series == 0] = None
    bfilled_num_days = temp.bfill()
    # Find zeros that are within the boundary of `max_days_to_spread`
    zeros_to_keep = (bfilled_num_days - stalled_days_count) >= max_days_to_spread
    zeros_to_replace = ~zeros_to_keep & (series == 0)
    # Calculate spreading factor (clipping at max_days_to_spread)
    num_days_worth_of_cases = num_days_worth_of_cases.clip(0, max_days_to_spread)
    num_days_worth_of_cases[~first_report_after_zeros] = 1
    num_days_worth_of_cases[zeros_to_replace] = None
    # Don't mess with leading / trailing zeros.
    if is_multiindex:
        non_zero_date_index = series[series.gt(0)].index.get_level_values("date")
        first_case = non_zero_date_index[0]
        last_case = non_zero_date_index[-1]
        date_index = series.index.get_level_values("date")
        is_between_first_last_case = (date_index > first_case) & (date_index <= last_case)
    else:
        first_case = series[series.gt(0)].index[0]
        last_case = series[series.gt(0)].index[-1]
        is_between_first_last_case = (series.index > first_case) & (series.index <= last_case)
    series[is_between_first_last_case] = (
        series[is_between_first_last_case] / num_days_worth_of_cases
    )
    zeros_to_replace = zeros_to_replace & is_between_first_last_case
    series[zeros_to_replace] = None
    series[is_between_first_last_case] = series[is_between_first_last_case].bfill()
    # Re-insert NaN values into the timeseries in their proper locations
    return series.combine_first(empty_dates)