def METHOD_NAME(
    series: Union[TimeSeries, Sequence[TimeSeries]],
    params: Mapping[str, Any],
    *args,
    **kwargs
) -> Union[Sequence[float], pd.core.series.Series]:
    lmbda, method = params["fixed"]["_lmbda"], params["fixed"]["_optim_method"]
    # If `global_fit` is `True`, then `series` will be ` Sequence[TimeSeries]`;
    # otherwise, `series` is a single `TimeSeries`:
    if isinstance(series, TimeSeries):
        series = [series]
    if lmbda is None:
        # Compute optimal lmbda for each dimension of the time series. In this case, the return type is
        # an ndarray and not a Sequence
        vals = np.concatenate([BoxCox.stack_samples(ts) for ts in series], axis=0)
        lmbda = np.apply_along_axis(boxcox_normmax, axis=0, arr=vals, method=method)
    elif isinstance(lmbda, Sequence):
        raise_if(
            len(lmbda) != series[0].width,
            "lmbda should have one value per dimension (ie. column or variable) of the time series",
            logger,
        )
    else:
        # Replicate lmbda to match dimensions of the time series
        lmbda = [lmbda] * series[0].width
    return lmbda