def METHOD_NAME(
    *,
    backend_class,
    gamma,
    idx,
    n,
    cell_id,
    dt_left,
    dt,
    dt_max,
    is_first_in_pair,
    expected_dt_left,
    expected_n_substep,
):
    # Arrange
    backend = backend_class()
    _gamma = backend.Storage.from_ndarray(np.asarray(gamma))
    _idx = make_Index(backend).from_ndarray(np.asarray(idx))
    _n = make_IndexedStorage(backend).from_ndarray(_idx, np.asarray(n))
    _cell_id = backend.Storage.from_ndarray(np.asarray(cell_id))
    _dt_left = backend.Storage.from_ndarray(np.asarray(dt_left))
    _is_first_in_pair = make_PairIndicator(backend)(len(n))
    _is_first_in_pair.indicator[:] = np.asarray(is_first_in_pair)
    _n_substep = backend.Storage.from_ndarray(np.zeros_like(dt_left, dtype=int))
    _dt_min = backend.Storage.from_ndarray(np.zeros_like(dt_left))
    dt_range = (np.nan, dt_max)
    # Act
    backend.scale_prob_for_adaptive_sdm_gamma(
        prob=_gamma,
        multiplicity=_n,
        cell_id=_cell_id,
        dt_left=_dt_left,
        dt=dt,
        dt_range=dt_range,
        is_first_in_pair=_is_first_in_pair,
        stats_n_substep=_n_substep,
        stats_dt_min=_dt_min,
    )
    # Assert
    np.testing.assert_array_almost_equal(
        _dt_left.to_ndarray(), np.asarray(expected_dt_left)
    )
    expected_gamma = np.empty_like(np.asarray(gamma))
    for i in range(len(idx)):
        if is_first_in_pair[i]:
            expected_gamma[i // 2] = (
                (dt - np.asarray(expected_dt_left[cell_id[i]]))
                / dt
                * np.asarray(gamma)[i // 2]
            )
    np.testing.assert_array_almost_equal(_gamma.to_ndarray(), expected_gamma)
    np.testing.assert_array_equal(_n_substep, np.asarray(expected_n_substep))