def METHOD_NAME(data):
    if isinstance(data.x, pd.DataFrame):
        t = len(data.y.index.levels[1])
        entities = data.x.index.levels[0]
        index_slice = pd.IndexSlice[entities[0] : entities[t - 1]]
        x = data.x.loc[index_slice, :]
    else:
        t = data.x.shape[1]
        x = data.x[:, :, :t]
    y = data.y
    weights = 1 + np.random.random_sample(t)
    with pytest.raises(AmbiguityError):
        PanelOLS(y, x, weights=weights)