code: def _ensure_format(obj):
      if isinstance(obj, FileFormat):
          return obj
      elif obj == "parquet":
          if not _parquet_available:
              raise ValueError(_parquet_msg)
          return ParquetFileFormat()
      elif obj in {"ipc", "arrow"}:
          return IpcFileFormat()
      elif obj == "feather":
          return FeatherFileFormat()
      elif obj == "csv":
          return CsvFileFormat()
      elif obj == "orc":
          if not _orc_available:
              raise ValueError(_orc_msg)
          return OrcFileFormat()
      elif obj == "json":
          return JsonFileFormat()
      else:
          raise ValueError("format '{}' is not supported".format(obj))
  
file_path: arrow/python/pyarrow/dataset.py
imports: import pyarrow
  from pyarrow.util import _is_iterable, _stringify_path, _is_path_like
  from pyarrow.compute import Expression, scalar, field
label_desc: Use image node_id 4 for calling a global function with example usage: _ensure_format(obj) and returns: obj, ParquetFileFormat, IpcFileFormat, FeatherFileFormat, CsvFileFormat, OrcFileFormat, JsonFileFormat