code: def _convert_label(label, convert_labels_to_binary=False):
      """Converts the label to 2D and optionally binarizes it.
  
      Args:
        label: A tensor of shape [batch_size, list_size, 1].
        convert_labels_to_binary: A boolean to indicate whether to use binary label.
  
      Returns:
        A tensor of shape [batch_size, list_size].
      """
      label = tf.cast(tf.squeeze(label, axis=2), tf.float32)
      if convert_labels_to_binary:
          label = tf.where(
              tf.greater(label, 0.0), tf.ones_like(label), label
          )
      return label
  
imports: import abc
  import dataclasses
  import os
  from typing import Any, Dict, List, Optional, Tuple, Union
  import tensorflow
  from tensorflow_ranking.python import data
  from tensorflow_ranking.python.keras import losses
  from tensorflow_ranking.python.keras import metrics
  from tensorflow_ranking.python.keras import model
  from tensorflow_ranking.python.keras import saved_model
  from tensorflow_ranking.python.keras import strategy_utils
label_desc: Use image node_id 2 for calling a global function with example usage: _convert_label(label, convert_labels_to_binary) and returns: label