code: def slice_nested_dict(dict_or_array, start, stop):
      """Slice a dictionary containing arrays (or dictionaries).
  
      This function is primarily intended for un-batching env_infos and
      action_infos.
  
      Args:
          dict_or_array (dict[str, dict or np.ndarray] or np.ndarray): A nested
              dictionary should only contain dictionaries and numpy arrays
              (recursively).
          start (int): First index to be included in the slice.
          stop (int): First index to be excluded from the slice. In other words,
              these are typical python slice indices.
  
      Returns:
          dict or np.ndarray: The input, but sliced.
  
      """
      if isinstance(dict_or_array, dict):
          return {
              k: slice_nested_dict(v, start, stop)
              for (k, v) in dict_or_array.items()
          }
      else:
          # It *should* be a numpy array (unless someone ignored the type
          # signature).
          return dict_or_array[start:stop]
  
file_path: garage/src/garage/np/_functions.py
imports: import warnings
  import numpy
  import scipy.signal
label_desc: Use image node_id 14 for calling a global function with example usage: slice_nested_dict(dict_or_array, start, stop) and returns: unknown, dict_or_array