def safe_indexing(X, indices):
    """Slice an array or dataframe. This is deprecated in sklearn"""
    if hasattr(X, 'iloc'):
        return X.iloc[indices]
    if hasattr(X, 'ndim') and X.ndim == 2:
        return X[(indices), :]
    return X[indices]
