code: def _comparison_condition(
      condition: Dict[str, Any], document: Document
  ) -> bool:
      if "field" not in condition:
          # 'field' key is only found in comparison dictionaries.
          # We assume this is a logic dictionary since it's not present.
          return _logic_condition(condition, document)
      field: str = condition["field"]
  
      if "operator" not in condition:
          msg = f"'operator' key missing in {condition}"
          raise FilterError(msg)
      if "value" not in condition:
          msg = f"'value' key missing in {condition}"
          raise FilterError(msg)
  
      if "." in field:
          # Handles fields formatted like so:
          # 'meta.person.name'
          parts = field.split(".")
          document_value = getattr(document, parts[0])
          for part in parts[1:]:
              if part not in document_value:
                  # If a field is not found we treat it as None
                  document_value = None
                  break
              document_value = document_value[part]
      elif field not in [f.name for f in fields(document)]:
          # Converted legacy filters don't add the `meta.` prefix, so we assume
          # that all filter fields that are not actual fields in Document are converted
          # filters.
          #
          # We handle this to avoid breaking compatibility with converted legacy filters.
          # This will be removed as soon as we stop supporting legacy filters.
          document_value = document.meta.get(field)
      else:
          document_value = getattr(document, field)
      operator: str = condition["operator"]
      filter_value: Any = condition["value"]
      return COMPARISON_OPERATORS[operator](
          filter_value=filter_value, document_value=document_value
      )
  
imports: from typing import List, Any, Union, Dict
  from dataclasses import fields
  from datetime import datetime
  import pandas
  from haystack.dataclasses import Document
  from haystack.errors import FilterError
label_desc: Use image node_id 14 for calling a global function with example usage: _comparison_condition(condition, document) and returns: COMPARISON_OPERATORS, _logic_condition