class_docstr: Text classification service
class_docstr_tok: ["Text","classification","service"]
code: def find_labeling_rule(
      self,
      dataset: ServiceTextClassificationDataset,
      rule_query: str,
      error_on_missing: bool = True,
  ) -> Optional[ServiceLabelingRule]:
      rule_query = rule_query.strip()
      for rule in dataset.rules:
          if rule.query == rule_query:
              return rule
      if error_on_missing:
          raise EntityNotFoundError(
              rule_query, type=ServiceLabelingRule
          )
  
imports: from typing import Iterable, List, Optional, Tuple
  from fastapi import Depends
  from argilla.server.errors.base_errors import EntityAlreadyExistsError, EntityNotFoundError, MissingDatasetRecordsError
  from argilla.server.services.datasets import DatasetsService
  from argilla.server.services.metrics import MetricsService
  from argilla.server.services.search.model import ServiceSearchResults, ServiceSortableField, ServiceSortConfig
  from argilla.server.services.search.service import SearchRecordsService
  from argilla.server.services.storage.service import RecordsStorageService
  from argilla.server.services.tasks.commons import BulkResponse
  from argilla.server.services.tasks.text_classification.metrics import TextClassificationMetrics
  from argilla.server.services.tasks.text_classification.model import DatasetLabelingRulesMetricsSummary, DatasetLabelingRulesSummary, LabelingRuleMetricsSummary, LabelingRuleSummary, ServiceLabelingRule, ServiceTextClassificationDataset, ServiceTextClassificationQuery, ServiceTextClassificationRecord
label_desc: Use image node_id 7 for calling the TextClassificationService obj's underlying member method code with example usage: obj.find_labeling_rule(dataset, rule_query, error_on_missing) and returns: rule