# Buggy code
def split(self, X, y=None, groups=None):
    """Generate indices to split data into training and test set.

    Parameters
    ----------
    X : array-like, shape (n_samples, n_features)
        Training data, where n_samples is the number of samples
        and n_features is the number of features.

    y : array-like, shape (n_samples,)
        The target variable for supervised learning problems.

    groups : array-like, with shape (n_samples,), optional
        Group labels for the samples used while splitting the dataset into
        train/test set.

    Returns
    -------
    train : ndarray
        The training set indices for that split.

    test : ndarray
        The testing set indices for that split.
    """
    X, y, groups = indexable(X, y, groups)
    n_samples = _num_samples(X)
    n_splits = self.n_splits
    n_folds = n_splits + 1
    if n_folds > n_samples:
        raise ValueError(
            (
                "Cannot have number of folds ={0} greater"
                " than the number of samples: {1}."
            ).format(n_folds, n_samples)
        )
    indices = np.arange(n_samples)
    test_size = n_samples // n_folds
    test_starts = range(test_size + n_samples % n_folds, n_samples, test_size)
    for test_start in test_starts:
        yield (indices[:test_start], indices[test_start : test_start + test_size])


# Traceback (ImportError)
In [3]: from sklearn.model_selection import train_test_split
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-3-139cc3505715> in <module>()
----> 1 from sklearn.model_selection import train_test_split

/usr/local/lib/python2.7/dist-packages/sklearn/model_selection/__init__.py in <module>()
15 from ._split import check_cv
16
---> 17 from ._validation import cross_val_score
18 from ._validation import cross_val_predict
19 from ._validation import learning_curve

/usr/local/lib/python2.7/dist-packages/sklearn/model_selection/_validation.py in <module>()
25 from ..utils.fixes import astype
26 from ..utils.validation import _is_arraylike, _num_samples
---> 27 from ..utils.metaestimators import _safe_split
28 from ..externals.joblib import Parallel, delayed, logger
29 from ..metrics.scorer import check_scoring

ImportError: cannot import name _safe_split

# Fixed code
def split(self, X, y=None, groups=None):
    """Generate indices to split data into training and test set.

    Parameters
    ----------
    X : array-like, shape (n_samples, n_features)
        Training data, where n_samples is the number of samples
        and n_features is the number of features.

    y : array-like, shape (n_samples,)
        Always ignored, exists for compatibility.

    groups : array-like, with shape (n_samples,), optional
        Always ignored, exists for compatibility.

    Returns
    -------
    train : ndarray
        The training set indices for that split.

    test : ndarray
        The testing set indices for that split.
    """
    X, y, groups = indexable(X, y, groups)
    n_samples = _num_samples(X)
    n_splits = self.n_splits
    n_folds = n_splits + 1
    if n_folds > n_samples:
        raise ValueError(
            (
                "Cannot have number of folds ={0} greater"
                " than the number of samples: {1}."
            ).format(n_folds, n_samples)
        )
    indices = np.arange(n_samples)
    test_size = n_samples // n_folds
    test_starts = range(test_size + n_samples % n_folds, n_samples, test_size)
    for test_start in test_starts:
        yield (indices[:test_start], indices[test_start : test_start + test_size])