<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def data_from_dataset(dataset, X_indexing=None, y_indexing=None):
 """Try to access X and y attribute from dataset. Also works when dataset is a subset. Parameters dataset : skorch.dataset.Dataset or torch.utils.data.Subset The incoming dataset should be a ``skorch.dataset.Dataset`` or a ``torch.utils.data.Subset`` of a ``skorch.dataset.Dataset``. X_indexing : function/callable or None (default=None) If not None, use this function for indexing into the X data. If None, try to automatically determine how to index data. y_indexing : function/callable or None (default=None) If not None, use this function for indexing into the y data. If None, try to automatically determine how to index data. """

    X, y = _none, _none

    if isinstance(dataset, Subset):
        X, y = data_from_dataset(
            dataset.dataset, X_indexing=X_indexing, y_indexing=y_indexing)
        X = multi_indexing(X, dataset.indices, indexing=X_indexing)
        y = multi_indexing(y, dataset.indices, indexing=y_indexing)
    elif hasattr(dataset, 'X') and hasattr(dataset, 'y'):
        X, y = dataset.X, dataset.y

    if (X is _none) or (y is _none):
        raise AttributeError("Could not access X and y from dataset.")
    return X, y