code: def test_rolling_custom_index_support():
      from pandas.api.indexers import BaseIndexer
  
      class CustomIndexer(BaseIndexer):
          def custom_get_window_bounds(
              self, num_values, min_periods, center, closed, step=None
          ):
              start = np.empty(num_values, dtype=np.int64)
              end = np.empty(num_values, dtype=np.int64)
  
              for i in range(num_values):
                  if self.use_expanding[i]:
                      start[i] = 0
                      end[i] = i + 1
                  else:
                      start[i] = i
                      end[i] = i + self.window_size
  
              return start, end
  
          if PANDAS_GE_150:
  
              def get_window_bounds(
                  self, num_values, min_periods, center, closed, step
              ):
                  return self.custom_get_window_bounds(
                      num_values, min_periods, center, closed, step
                  )
  
          else:
  
              def get_window_bounds(
                  self, num_values, min_periods, center, closed
              ):
                  return self.custom_get_window_bounds(
                      num_values, min_periods, center, closed
                  )
  
      use_expanding = [True, False, True, False, True]
      indexer = CustomIndexer(
          window_size=1, use_expanding=use_expanding
      )
  
      df = pd.DataFrame({"values": range(5)})
      gdf = cudf.from_pandas(df)
  
      expected = df.rolling(window=indexer).sum()
      actual = gdf.rolling(window=indexer).sum()
  
      assert_eq(expected, actual, check_dtype=False)
  
imports: import math
  from contextlib import contextmanager
  import numpy
  import pandas
  import pytest
  import cudf
  from cudf.core._compat import PANDAS_GE_150
  from cudf.testing._utils import _create_pandas_series_float64_default, assert_eq
  from cudf.testing.dataset_generator import rand_dataframe
label_desc: Use image node_id 17 for calling a global function with example usage: test_rolling_custom_index_support() and returns: start,  end, self, self