code: def _to_search_engine_filter(
      filters: Filters, user: Optional[User]
  ) -> SearchEngineFilter:
      engine_filters = []
  
      for filter in filters.and_:
          engine_scope = _to_search_engine_scope(
              filter.scope, user=user
          )
  
          if isinstance(filter, TermsFilter):
              engine_filter = SearchEngineTermsFilter(
                  scope=engine_scope, values=filter.values
              )
          elif isinstance(filter, RangeFilter):
              engine_filter = SearchEngineRangeFilter(
                  scope=engine_scope, ge=filter.ge, le=filter.le
              )
          else:
              raise Exception(f"Unknown filter type {type(filter)}")
  
          engine_filters.append(engine_filter)
  
      return AndFilter(filters=engine_filters)
  
imports: import re
  from typing import Dict, List, Optional, Tuple, Union
  from uuid import UUID
  from fastapi import APIRouter, Depends, HTTPException, Query, Security, status
  from sqlalchemy.ext.asyncio import AsyncSession
  from typing_extensions import Annotated
  import argilla.server.errors.future
  from argilla.server.apis.v1.handlers.datasets.datasets import _get_dataset
  from argilla.server.contexts import datasets, search
  from argilla.server.database import get_async_db
  from argilla.server.enums import MetadataPropertyType, RecordSortField, ResponseStatusFilter, SortOrder
  from argilla.server.models import Dataset
  from argilla.server.models import Record, User
  from argilla.server.policies import DatasetPolicyV1, authorize
  from argilla.server.schemas.v1.datasets import Dataset, Filters, FilterScope, MetadataFilterScope, MetadataParsedQueryParam, MetadataQueryParams, Order, RangeFilter, RecordFilterScope, RecordIncludeParam, Records, RecordsCreate, RecordsUpdate, ResponseFilterScope, SearchRecord, SearchRecordsQuery, SearchRecordsResult, SearchSuggestionOptions, SearchSuggestionOptionsQuestion, SearchSuggestionsOptions, SuggestionFilterScope, TermsFilter, VectorSettings
  from argilla.server.schemas.v1.datasets import Record
  from argilla.server.search_engine import AndFilter, FloatMetadataFilter, IntegerMetadataFilter, MetadataFilter, SearchEngine, SearchResponses, SortBy, TermsMetadataFilter, UserResponseStatusFilter, get_search_engine
  from argilla.server.search_engine import Filter
  from argilla.server.search_engine import FilterScope
  from argilla.server.search_engine import MetadataFilterScope
  from argilla.server.search_engine import Order
  from argilla.server.search_engine import RangeFilter
  from argilla.server.search_engine import RecordFilterScope
  from argilla.server.search_engine import ResponseFilterScope
  from argilla.server.search_engine import SuggestionFilterScope
  from argilla.server.search_engine import TermsFilter
  from argilla.server.security import auth
  from argilla.server.telemetry import TelemetryClient, get_telemetry_client
  from argilla.server.utils import parse_query_param, parse_uuids
label_desc: Use image node_id 2 for calling a global function with example usage: _to_search_engine_filter(filters, user) and returns: AndFilter