def METHOD_NAME(data):
    # Same size
    n = np.prod(data.y.shape)
    weights = 1 + np.random.random_sample(n)
    mod = PanelOLS(data.y, data.x, weights=weights)
    mod.fit()
    w = mod.weights.values2d
    missing = PanelData(data.y).isnull | PanelData(data.x).isnull
    expected = weights[~missing.squeeze()][:, None]
    expected = expected / expected.mean()
    assert w == pytest.approx(expected)
    # Per time
    if isinstance(data.x, pd.DataFrame):
        n = len(data.y.index.levels[1])
        k = len(data.y.index.levels[0])
    elif isinstance(data.x, np.ndarray):
        n = data.y.shape[0]
        k = data.y.shape[1]
    else:
        n = data.y.shape[1]
        k = data.y.shape[2]
    weights = 1 + np.random.random_sample(n)
    mod = PanelOLS(data.y, data.x, weights=weights)
    mod.fit()
    w = mod.weights.values2d
    expected = weights[:, None] @ np.ones((1, k))
    expected = expected.T.ravel()
    expected = expected[~missing.squeeze()][:, None]
    expected = expected / expected.mean()
    assert w == pytest.approx(expected)
    # Per entity
    if isinstance(data.x, pd.DataFrame):
        n = len(data.y.index.levels[0])
        k = len(data.y.index.levels[1])
    elif isinstance(data.x, np.ndarray):
        n = data.y.shape[1]
        k = data.y.shape[0]
    else:
        n = data.y.shape[2]
        k = data.y.shape[1]
    weights = 1 + np.random.random_sample(n)
    mod = PanelOLS(data.y, data.x, weights=weights)
    mod.fit()
    w = mod.weights.values2d
    expected = np.ones((k, 1)) @ weights[None, :]
    expected = expected.T.ravel()
    expected = expected[~missing.squeeze()][:, None]
    expected = expected / expected.mean()
    assert w == pytest.approx(expected)
    weights = 1 + np.random.random_sample(data.y.shape)
    mod = PanelOLS(data.y, data.x, weights=weights)
    mod.fit()
    w = mod.weights.values2d
    expected = weights.T.ravel()
    expected = expected[~missing.squeeze()][:, None]
    expected = expected / expected.mean()
    assert w == pytest.approx(expected)