code: def filters_to_expression(filters):
      """
      Check if filters are well-formed and convert to an ``Expression``.
  
      Parameters
      ----------
      filters : List[Tuple] or List[List[Tuple]]
  
      Notes
      -----
      See internal ``pyarrow._DNF_filter_doc`` attribute for more details.
  
      Examples
      --------
  
      >>> filters_to_expression([('foo', '==', 'bar')])
      <pyarrow.compute.Expression (foo == "bar")>
  
      Returns
      -------
      pyarrow.compute.Expression
          An Expression representing the filters
      """
      import pyarrow.dataset as ds
  
      if isinstance(filters, ds.Expression):
          return filters
  
      filters = _check_filters(filters, check_null_strings=False)
  
      def convert_single_predicate(col, op, val):
          field = ds.field(col)
  
          if op == "=" or op == "==":
              return field == val
          elif op == "!=":
              return field != val
          elif op == "<":
              return field < val
          elif op == ">":
              return field > val
          elif op == "<=":
              return field <= val
          elif op == ">=":
              return field >= val
          elif op == "in":
              return field.isin(val)
          elif op == "not in":
              return ~field.isin(val)
          else:
              raise ValueError(
                  '"{0}" is not a valid operator in predicates.'.format(
                      (col, op, val)
                  )
              )
  
      disjunction_members = []
  
      for conjunction in filters:
          conjunction_members = [
              convert_single_predicate(col, op, val)
              for col, op, val in conjunction
          ]
  
          disjunction_members.append(
              reduce(operator.and_, conjunction_members)
          )
  
      return reduce(operator.or_, disjunction_members)
  
imports: from collections import defaultdict
  from contextlib import nullcontext
  from functools import reduce
  import inspect
  import json
  import os
  import re
  import operator
  import warnings
  import pyarrow
  from pyarrow._parquet import ParquetReader, Statistics, FileMetaData, RowGroupMetaData, ColumnChunkMetaData, ParquetSchema, ColumnSchema, ParquetLogicalType, FileEncryptionProperties, FileDecryptionProperties, SortingColumn
  from pyarrow.fs import LocalFileSystem, FileSystem, FileType, _resolve_filesystem_and_path, _ensure_filesystem
  from pyarrow import filesystem
  from pyarrow.util import guid, _is_path_like, _stringify_path, _deprecate_api
label_desc: Use image node_id 3 for calling a global function with example usage: filters_to_expression(filters) and returns: reduce, filters, unknown, unknown, unknown, unknown, unknown, unknown, field, unknown