code: def slice_to_list(sl: slice, max_len: int) -> List[int]:
      """
      Turn a slice object into a list
  
      Parameters
      ----------
      sl: slice
          The slice object
  
      max_len: int
          Max length of the iterable
  
      Returns
      -------
      list
          The converted list
      """
  
      if sl.start is None:
          start = 0
      elif sl.start < 0:
          start = max_len + sl.start
      else:
          start = sl.start
  
      if sl.stop is None:
          stop = max_len
      elif sl.stop < 0:
          stop = max_len + sl.stop
      else:
          stop = sl.stop
  
      if sl.step is None:
          step = 1
      else:
          step = sl.step
  
      return list(range(start, stop, step))
  
file_path: graph4nlp/graph4nlp/pytorch/data/utils.py
imports: from typing import Any, List, Tuple, Union
  import torch
label_desc: Use image node_id 3 for calling a global function with example usage: slice_to_list(sl, max_len) and returns: list