code: def validate_fields(
      fields: typing.Union[
          AllowedFieldTypes, typing.List[AllowedFieldTypes]
      ]
  ):
      """Validates that the fields used in the filters are valid."""
      if not isinstance(fields, list):
          raise TypeError(
              f"Expected `fields` to be a list, got {type(fields)} instead."
          )
  
      any_required = False
      unique_names = set()
      for field in fields:
          if not isinstance(field, AllowedFieldTypes):
              raise TypeError(
                  f"Expected `fields` to be a list of `{AllowedFieldTypes.__name__}`, got {type(field)} instead."
              )
          if field.name in unique_names:
              raise ValueError(
                  f"Expected `fields` to have unique names, got {field.name} twice instead."
              )
          unique_names.add(field.name)
          if not any_required and field.required:
              any_required = True
  
      if not any_required:
          raise ValueError(
              "At least one field in `fields` must be required (`required=True`)."
          )
  
imports: import typing
  from typing import Any, Dict, List, Optional, Type, Union
  import httpx
  from argilla.client.feedback.constants import FIELD_TYPE_TO_PYTHON_TYPE
  from argilla.client.feedback.dataset.base import FeedbackDatasetBase
  from argilla.client.feedback.schemas import FeedbackRecord
  from argilla.client.feedback.schemas.enums import MetadataPropertyTypes
  from argilla.client.feedback.schemas.types import AllowedFieldTypes, AllowedMetadataPropertyTypes, AllowedQuestionTypes
  from argilla.client.sdk.v1.datasets import api
  from argilla.client.sdk.v1.datasets.models import FeedbackDatasetModel
  from argilla.client.singleton import active_client
  from argilla.client.workspaces import Workspace
  from argilla.pydantic_v1 import BaseModel, Extra, ValidationError, create_model
label_desc: Use image node_id 1 for calling a global function with example usage: validate_fields(fields) without return types