code: def _convert_to_list_index(
      index: typing.Union[int, slice, np.array], length: int
  ):
      if isinstance(index, int):
          index = [index]
      elif isinstance(index, slice):
          index = list(range(*index.indices(length)))
      return index
  
imports: import typing
  import inspect
  from pathlib import Path
  import functools
  import dill
  from tqdm import tqdm
  import numpy
  import pandas
  import matchzoo
label_desc: Use image node_id 1 for calling a global function with example usage: _convert_to_list_index(index, length) and returns: index