code: def assert_model_sparsity(
      test_case, sparsity, model, rtol=1e-6, atol=1e-6
  ):
      for layer in model.layers:
          if isinstance(layer, pruning_wrapper.PruneLowMagnitude):
              for weight in layer.layer.get_prunable_weights():
                  test_case.assertAllClose(
                      sparsity,
                      _get_sparsity(tf.keras.backend.get_value(weight)),
                      rtol=rtol,
                      atol=atol,
                  )
  
file_path: model-optimization/tensorflow_model_optimization/python/core/sparsity/keras/test_utils.py
imports: import tempfile
  import numpy
  import tensorflow
  from tensorflow_model_optimization.python.core.sparsity.keras import prune
  from tensorflow_model_optimization.python.core.sparsity.keras import pruning_utils
  from tensorflow_model_optimization.python.core.sparsity.keras import pruning_wrapper
label_desc: Use image node_id 12 for calling a global function with example usage: assert_model_sparsity(test_case, sparsity, model, rtol, atol) without return types