code: def set_ranges(
      self,
      record_range: IndexRange,
      record_density: int,
      index_range: Optional[IndexRange] = None,
      index_density: Optional[int] = None,
      record_step: Optional[int] = None,
  ):
      self.record_range = record_range
      self.record_density = record_density
  
      if self.use_list:
          assert index_range is not None
          assert index_density is not None
          self.index_range = index_range
          self.index_density = index_density
          (
              self.total_record_range,
              self.total_index_range,
          ) = self._calculate_ranges()
      else:
          self.total_record_range = self._calculate_ranges()
  
      if record_step is not None:
          if record_step < 0:
              record_step += self.total_record_range.stop
          assert record_step < self.total_record_range.stop
  
          self.record_range = IndexRange(record_step, record_step + 1)
  
      self._adjust_ranges()
      if self.use_list:
          step = (
              self.index_range.stop - self.index_range.start
          ) // index_density or 1
          self.index_slice = slice(
              self.index_range.start, self.index_range.stop, step
          )
  
imports: import asyncio
  import time
  from typing import Iterable, Iterator, List, Tuple, Union, Optional
  from typing import TYPE_CHECKING
  from aim.web.api.runs.utils import ASYNC_SLEEP_INTERVAL, PROGRESS_KEY_SUFFIX, IndexRange, collect_streamable_data, get_run_props, get_run_params
  from aim.web.configs import AIM_PROGRESS_REPORT_INTERVAL
  from aim.sdk.uri_service import URIService, generate_resource_path
  from aim.sdk.sequence_collection import SequenceCollection
  from aim.sdk.sequence import Sequence
  from aim.storage.treeutils import encode_tree
  from aim.storage.context import Context
label_desc: Use image node_id 5 for calling the CustomObjectApi obj's underlying member method code with example usage: obj.set_ranges(record_range, record_density, index_range, index_density, record_step) without return types