code: def test_penalized_wls():
      np.random.seed(1)
      n = 20
      p = 3
      x = np.random.normal(0, 1, (n, 3))
      y = x[:, 1] - x[:, 2] + np.random.normal(0, 0.1, n)
      y -= y.mean()
  
      weights = np.ones(shape=(n,))
      s = np.random.normal(0, 1, (p, p))
  
      pen_wls_res = penalized_wls(y, x, 0 * s, weights)
      ls_res = lm.OLS(y, x).fit()
  
      assert_allclose(ls_res.params, pen_wls_res.params)
  
imports: import os
  import numpy
  from numpy.testing import assert_allclose
  import pandas
  from scipy.linalg import block_diag
  import pytest
  from statsmodels.tools.linalg import matrix_sqrt
  from statsmodels.gam.smooth_basis import UnivariatePolynomialSmoother, PolynomialSmoother, BSplines, GenericSmoothers, UnivariateCubicSplines, CyclicCubicSplines
  from statsmodels.gam.generalized_additive_model import GLMGam, LogitGam, make_augmented_matrix, penalized_wls
  from statsmodels.gam.gam_cross_validation.gam_cross_validation import MultivariateGAMCV, MultivariateGAMCVPath, _split_train_test_smoothers
  from statsmodels.gam.gam_penalties import UnivariateGamPenalty, MultivariateGamPenalty
  from statsmodels.gam.gam_cross_validation.cross_validators import KFold
  from statsmodels.genmod.generalized_linear_model import GLM
  from statsmodels.genmod.families.family import Gaussian
  from statsmodels.genmod.generalized_linear_model import lm
label_desc: Use image node_id 21 for calling a global function with example usage: test_penalized_wls() without return types