code: def consistency_exactly_one(
      instance: SQABase, exactly_one_fields: List[str]
  ) -> Any:
      """Ensure that exactly one of `exactly_one_fields` has a value set."""
      values = [
          getattr(instance, field) is not None
          for field in exactly_one_fields
      ]
      if sum(values) != 1:
          raise ValueError(
              f"{instance.__class__.__name__} must have exactly one of the following "
              f"fields set: {', '.join(exactly_one_fields)}."
          )
  
file_path: Ax/ax/storage/sqa_store/validation.py
imports: from logging import Logger
  from typing import Any, Callable, List, TypeVar
  from ax.storage.sqa_store.db import SQABase
  from ax.storage.sqa_store.reduced_state import GR_LARGE_MODEL_ATTRS
  from ax.storage.sqa_store.sqa_classes import ONLY_ONE_FIELDS, ONLY_ONE_METRIC_FIELDS, SQAMetric, SQAParameter, SQAParameterConstraint, SQARunner
  from ax.utils.common.logger import get_logger
  from sqlalchemy import event
  from sqlalchemy.engine import Connection
  from sqlalchemy.orm.attributes import InstrumentedAttribute
  from sqlalchemy.orm.base import NO_VALUE
  from sqlalchemy.orm.mapper import Mapper
label_desc: Use image node_id 2 for calling a global function with example usage: consistency_exactly_one(instance, exactly_one_fields) without return types