code: def _ensure_partitioning(scheme):
      """
      Validate input and return a Partitioning(Factory).
  
      It passes None through if no partitioning scheme is defined.
      """
      if scheme is None:
          pass
      elif isinstance(scheme, str):
          scheme = partitioning(flavor=scheme)
      elif isinstance(scheme, list):
          scheme = partitioning(field_names=scheme)
      elif isinstance(scheme, (Partitioning, PartitioningFactory)):
          pass
      else:
          ValueError(
              "Expected Partitioning or PartitioningFactory, got {}".format(
                  type(scheme)
              )
          )
      return scheme
  
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 3 for calling a global function with example usage: _ensure_partitioning(scheme) and returns: scheme