def _check_inputs(X, y=None):
    """Converts a matrix X into a list of lists and a vector y into a list."""
    new_X = []
    for row in X:
        new_row = []
        for val in row:
            new_row.append(float(val))
        new_X.append(new_row)
    if y is None:
        return new_X
    else:
        new_y = []
        for val in y:
            try:
                new_y.append(float(val))
            except:
                new_y.append(float(val[0]))
        assert len(X) == len(y), 'Dimensions of X and y do not match.'
        return new_X, new_y
