code: def quantize_model(to_quantize, quantized_layer_name_prefix="quant_"):
      """Quantize a `tf.keras` model with the default quantization implementation.
  
      Quantization constructs a model which emulates quantization during training.
      This allows the model to learn parameters robust to quantization loss, and
      also model the accuracy of a quantized model.
  
      For more information, see
      https://www.tensorflow.org/model_optimization/guide/quantization/training
  
      Quantize a model:
  
      ```python
      # Quantize sequential model
      model = quantize_model(
          keras.Sequential([
              layers.Dense(10, activation='relu', input_shape=(100,)),
              layers.Dense(2, activation='sigmoid')
          ]))
  
      # Quantize functional model
      in = tf.keras.Input((3,))
      out = tf.keras.Dense(2)(in)
      model = tf.keras.Model(in, out)
  
      quantized_model = quantize_model(model)
      ```
  
      Note that this function removes the optimizer from the original model.
  
      The returned model copies over weights from the original model. So while
      it preserves the original weights, training it will not modify the weights
      of the original model.
  
      Args:
        to_quantize: tf.keras model to be quantized. It can have pre-trained
          weights.
        quantized_layer_name_prefix: Name prefix for the quantized layers. The
          default is `quant_`.
  
      Returns:
        Returns a new `tf.keras` model prepared for quantization.
      """
      if to_quantize is None:
          raise ValueError("`to_quantize` cannot be None")
  
      if quantized_layer_name_prefix is None:
          quantized_layer_name_prefix = ""
  
      if not isinstance(to_quantize, keras.Model):
          raise ValueError(
              "`to_quantize` can only be a `tf.keras.Model` instance. Use "
              "the `quantize_annotate_layer` API to handle individual layers."
              "You passed an instance of type: {input}.".format(
                  input=to_quantize.__class__.__name__
              )
          )
  
      if (
          not isinstance(to_quantize, keras.Sequential)
          and not to_quantize._is_graph_network
      ):  # pylint: disable=protected-access
          raise ValueError(
              "`to_quantize` can only either be a tf.keras Sequential or "
              "Functional model."
          )
  
      annotated_model = quantize_annotate_model(to_quantize)
      return quantize_apply(
          annotated_model,
          quantized_layer_name_prefix=quantized_layer_name_prefix,
      )
  
imports: import warnings
  import tensorflow
  from tensorflow_model_optimization.python.core.keras import metrics
  from tensorflow_model_optimization.python.core.quantization.keras import quantize_annotate
  from tensorflow_model_optimization.python.core.quantization.keras import quantize_aware_activation
  from tensorflow_model_optimization.python.core.quantization.keras import quantize_config
  from tensorflow_model_optimization.python.core.quantization.keras import quantize_layer
  from tensorflow_model_optimization.python.core.quantization.keras import quantize_wrapper
  from tensorflow_model_optimization.python.core.quantization.keras import quantizers
  from tensorflow_model_optimization.python.core.quantization.keras import utils
  from tensorflow_model_optimization.python.core.quantization.keras.default_8bit import default_8bit_quantize_registry
  from tensorflow_model_optimization.python.core.quantization.keras.default_8bit import default_8bit_quantize_scheme
  from tensorflow_model_optimization.python.core.quantization.keras.experimental.default_n_bit import default_n_bit_quantize_registry
label_desc: Use image node_id 2 for calling a global function with example usage: quantize_model(to_quantize, quantized_layer_name_prefix) and returns: quantize_apply