code: def build_bert_classifier(
      bert_layer: tf.keras.layers.Layer,
      max_len: int,
      num_classes: int,
      dropout: float = 0.1,
      activation: Optional[str] = None,
  ):
      """BERT Keras model for classification.
  
      Connect configurable fully connected layers on top of the BERT
      pooled_output.
  
      Args:
        bert_layer: A tensorflow_hub.KerasLayer intence of BERT layer.
        max_len: The maximum length of preprocessed tokens.
        num_classes: Number of unique classes in the labels. Determines the output
          shape of the classification layer.
        dropout: Dropout rate to be used for the classification layer.
        activation: Activation function to use. If you don't specify anything, no
          activation is applied (ie. "linear" activation: a(x) = x).
  
      Returns:
        A Keras model.
      """
      input_layer_names = [
          "input_word_ids",
          "input_mask",
          "segment_ids",
      ]
  
      input_layers = [
          keras.layers.Input(
              shape=(max_len,), dtype=tf.int64, name=name
          )
          for name in input_layer_names
      ]
  
      converted_layers = [tf.cast(k, tf.int32) for k in input_layers]
  
      pooled_output, _ = bert_layer(converted_layers)
      output = keras.layers.Dropout(dropout)(pooled_output)
      output = keras.layers.Dense(num_classes, activation=activation)(
          output
      )
      model = keras.Model(input_layers, output)
      return model
  
imports: from typing import Optional, List, Union
  import tensorflow
  import tensorflow.keras
label_desc: Use image node_id 1 for calling a global function with example usage: build_bert_classifier(bert_layer, max_len, num_classes, dropout, activation) and returns: model