code: def _labels_from_annotation(
      cls, annotation: TextClassificationAnnotation, multi_label: bool
  ) -> Union[List[str], List[int]]:
      if not annotation:
          return []
  
      if multi_label:
          return [
              label.class_label
              for label in annotation.labels
              if label.score > 0.5
          ]
  
      class_prediction = cls._max_class_prediction(
          annotation, multi_label=multi_label
      )
      if class_prediction is None:
          return []
  
      return [class_prediction.class_label]
  
imports: from datetime import datetime
  from typing import Any, ClassVar, Dict, List, Optional, Union
  from argilla.server.commons.models import PredictionStatus, TaskStatus, TaskType
  from argilla.server.constants import DEFAULT_MAX_KEYWORD_LENGTH
  from argilla.server.helpers import flatten_dict
  from argilla.server.pydantic_v1 import BaseModel, Field, root_validator, validator
  from argilla.server.services.datasets import ServiceBaseDataset
  from argilla.server.services.search.model import ServiceBaseRecordsQuery, ServiceScoreRange
  from argilla.server.services.tasks.commons import ServiceBaseAnnotation, ServiceBaseRecord
label_desc: Use image node_id 12 for calling the ServiceTextClassificationRecord obj's underlying member method code with example usage: obj._labels_from_annotation(cls, annotation, multi_label) and returns: list, list, unknown, list