code: def _validate_label_map(label_map):
      """Checks if a label map is valid.
  
      Args:
        label_map: StringIntLabelMap to validate.
  
      Raises:
        ValueError: if label map is invalid.
      """
      for item in label_map.item:
          if item.id < 0:
              raise ValueError("Label map ids should be >= 0.")
          if (
              item.id == 0
              and item.name != "background"
              and item.display_name != "background"
          ):
              raise ValueError(
                  "Label map id 0 is reserved for the background label"
              )
  
imports: from absl import logging
  from six.moves import range
label_desc: Use image node_id 1 for calling a global function with example usage: _validate_label_map(label_map) without return types