'Check X and y types and dimensions.'

def _check_Xy(self, X, y=None):

    if ((not isinstance(X, np.ndarray)) or (X.ndim != 3)):
        raise ValueError('X    must    be    an    array    of    shape    (n_epochs,    n_channels,    n_samples).')
    if (y is None):
        y = np.ones(len(X))
    y = np.asarray(y)
    if (len(X) != len(y)):
        raise ValueError('X    and    y    must    have    the    same    length')
    return (X, y)
