code: def _safe_slice(array, idx):
      """Slice an array safely along the row axis"""
      if array is None:
          return array
      elif hasattr(array, "iloc"):
          return array.iloc[idx]
      return array[idx]
  
file_path: mlens/mlens/parallel/_base_functions.py
imports: from __future__ import division
  import os
  import warnings
  from scipy.sparse import issparse
  import numpy
  from ..utils import pickle_load, pickle_save, load
  from ..utils.exceptions import MetricWarning, ParameterChangeWarning
label_desc: Use image node_id 7 for calling a global function with example usage: _safe_slice(array, idx) and returns: array, array, array