def _index_value(self, key, value, index, error_type: Type[Exception]=RuntimeError):
    if isinstance(value, dict):
        return DictIndexProxy(value, index, (self._prefix + key))
    elif isinstance(value, tuple):
        return new_tuple(type(value), (self._index_value(f'{key}[{i}]', v, index, error_type) for (i, v) in enumerate(value)))
    elif isinstance(value, (to.Tensor, np.ndarray)):
        return value[(index, ...)]
    elif isinstance(value, list):
        return value[index]
    else:
        raise error_type(f'Entry {self._prefix}{key} has un-gettable type {type(value)}')
def _index_value(self, key, value, index, error_type: Type[Exception]=RuntimeError):
    if isinstance(value, dict):
        return DictIndexProxy(value, index, (self._prefix + key))
    elif isinstance(value, tuple):
        return new_tuple(type(value), (self._index_value(f'{key}[{i}]', v, index, error_type) for (i, v) in enumerate(value)))
    elif isinstance(value, (to.Tensor, np.ndarray)):
        return value[(index, ...)]
    elif isinstance(value, list):
        return value[index]
    else:
        raise error_type(f'Entry {self._prefix}{key} has un-gettable type {type(value)}')