code: def test_squared_loss_derivative_lipschitz_constant(rng):
      """Test Lipschitz-continuity of the derivative of squared_loss loss \
      function."""
      X, y, w, mask, *_ = _make_data()
      grad_weight = 2.08e-1
  
      lipschitz_constant = _squared_loss_derivative_lipschitz_constant(
          X, mask, grad_weight
      )
  
      for _ in range(20):
          x_1 = rng.random(w.shape) * rng.integers(1000)
          x_2 = rng.random(w.shape) * rng.integers(1000)
          gradient_difference = linalg.norm(
              _squared_loss_and_spatial_grad_derivative(
                  X, y, x_1, mask, grad_weight
              )
              - _squared_loss_and_spatial_grad_derivative(
                  X, y, x_2, mask, grad_weight
              )
          )
          point_difference = linalg.norm(x_1 - x_2)
  
          assert (
              gradient_difference
              <= lipschitz_constant * point_difference
          )
  
imports: import numpy
  import pytest
  import scipy
  from nibabel import Nifti1Image
  from numpy.testing import assert_almost_equal
  from scipy import linalg
  from nilearn.decoding._objective_functions import divergence, gradient
  from nilearn.decoding.space_net import BaseSpaceNet
  from nilearn.decoding.space_net_solvers import _graph_net_adjoint_data_function, _graph_net_data_function, _logistic_data_loss_and_spatial_grad, _logistic_data_loss_and_spatial_grad_derivative, _logistic_derivative_lipschitz_constant, _squared_loss_and_spatial_grad, _squared_loss_and_spatial_grad_derivative, _squared_loss_derivative_lipschitz_constant, mfista
  from nilearn.decoding.tests._testing import create_graph_net_simulation_data
  from .test_same_api import to_niimgs
label_desc: Use image node_id 9 for calling a global function with example usage: test_squared_loss_derivative_lipschitz_constant(rng) without return types