code: def _get_aggregation_depth(aggregate_files, partition_names):
      # Use `aggregate_files` to set `aggregation_depth`
      #
      # Note that `partition_names` must be ordered. `True` means that we allow
      # aggregation of any two files. `False` means that we will never aggregate
      # files.  If a string is specified, it must be the name of a partition
      # column, and the "partition depth" of that column will be used for
      # aggregation.  Note that we always convert the string into the partition
      # "depth" to simplify the aggregation logic.
  
      # Summary of output `aggregation_depth` settings:
      #
      # True  : Free-for-all aggregation (any two files may be aggregated)
      # False : No file aggregation allowed
      # <int> : Allow aggregation within this partition-hierarchy depth
  
      aggregation_depth = aggregate_files
      if isinstance(aggregate_files, str):
          if aggregate_files in partition_names:
              # aggregate_files corresponds to a partition column. Reset the
              # value of this variable to reflect the partition "depth" (in the
              # range of 1 to the total number of partition levels)
              aggregation_depth = len(
                  partition_names
              ) - partition_names.index(aggregate_files)
          else:
              raise ValueError(
                  f"{aggregate_files} is not a recognized directory partition."
              )
  
      return aggregation_depth
  
imports: from __future__ import annotations
  import re
  import warnings
  import numpy
  import pandas
  from fsspec.core import expand_paths_if_needed, get_fs_token_paths, stringify_path
  from fsspec.spec import AbstractFileSystem
  from dask import config
  from dask.dataframe.io.utils import _is_local_fs
  from dask.utils import natural_sort_key, parse_bytes
label_desc: Use image node_id 7 for calling a global function with example usage: _get_aggregation_depth(aggregate_files, partition_names) and returns: aggregation_depth