code: def check_model_sparsity_2x4(model):
      for layer in model.layers:
          if isinstance(
              layer, pruning_wrapper.PruneLowMagnitude
          ) and isinstance(layer.layer, PRUNABLE_2x4_LAYERS):
              for weight in layer.layer.get_prunable_weights():
                  if not pruning_utils.is_pruned_m_by_n(weight):
                      return False
      return True
  
file_path: model-optimization/tensorflow_model_optimization/python/examples/sparsity/keras/mnist/mnist_e2e_sparsity2x4.py
imports: from __future__ import print_function
  from absl import app
  import tensorflow
  from tensorflow_model_optimization.python.core.keras import test_utils
  from tensorflow_model_optimization.python.core.sparsity.keras import prune
  from tensorflow_model_optimization.python.core.sparsity.keras import pruning_callbacks
  from tensorflow_model_optimization.python.core.sparsity.keras import pruning_schedule
  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 1 for calling a global function with example usage: check_model_sparsity_2x4(model) and returns: True, False