code: def selective_cluster_model(original_model, sparsity_flag):
      cluster_epoch = 1
      clustering_params = {
          "number_of_clusters": 8,
          "cluster_centroids_init": (
              tfmot_cluster_config.CentroidInitialization.DENSITY_BASED
          ),
          "preserve_sparsity": sparsity_flag,
      }
  
      def apply_clustering_to_conv2d(layer):
          if isinstance(layer, tf.keras.layers.Conv2D):
              return exp_tfmot_cluster.cluster_weights(
                  layer, **clustering_params
              )
          return layer
  
      cluster_model = tf.keras.models.clone_model(
          original_model,
          clone_function=apply_clustering_to_conv2d,
      )
  
      callbacks = []
      cluster_model = _train_model(
          cluster_model, callbacks, cluster_epoch
      )
  
      clustered_model_stripped = tfmot_cluster.strip_clustering(
          cluster_model
      )
  
      return cluster_model, clustered_model_stripped
  
imports: import numpy
  import tensorflow
  from tensorflow_model_optimization.python.core.clustering.keras import cluster
  from tensorflow_model_optimization.python.core.clustering.keras import cluster_config
  from tensorflow_model_optimization.python.core.clustering.keras.experimental import cluster
  from tensorflow_model_optimization.python.core.quantization.keras import quantize
  from tensorflow_model_optimization.python.core.quantization.keras.collab_opts.cluster_preserve import cluster_utils
  from tensorflow_model_optimization.python.core.quantization.keras.collab_opts.cluster_preserve import default_8bit_cluster_preserve_quantize_scheme
  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
label_desc: Use image node_id 7 for calling a global function with example usage: selective_cluster_model(original_model, sparsity_flag) and returns: cluster_model,  clustered_model_stripped, layer, exp_tfmot_cluster