code: def _percentile(a, q, method="linear"):
      n = len(a)
      if not len(a):
          return None, n
      if isinstance(q, Iterator):
          q = list(q)
      if a.dtype.name == "category":
          result = np_percentile(a.cat.codes, q, method=method)
          import pandas as pd
  
          return (
              pd.Categorical.from_codes(
                  result, a.dtype.categories, a.dtype.ordered
              ),
              n,
          )
      if type(a.dtype).__name__ == "DatetimeTZDtype":
          import pandas as pd
  
          if isinstance(a, (pd.Series, pd.Index)):
              a = a.values
  
      if np.issubdtype(a.dtype, np.datetime64):
          values = a
          if type(a).__name__ in ("Series", "Index"):
              from dask.dataframe._compat import PANDAS_GE_200
  
              if PANDAS_GE_200:
                  a2 = values.astype("i8")
              else:
                  a2 = values.view("i8")
          else:
              a2 = values.view("i8")
          result = np_percentile(a2, q, method=method).astype(
              values.dtype
          )
          if q[0] == 0:
              # https://github.com/dask/dask/issues/6864
              result[0] = min(result[0], values.min())
          return result, n
      if not np.issubdtype(a.dtype, np.number):
          method = "nearest"
      return np_percentile(a, q, method=method), n
  
file_path: dask/dask/array/percentile.py
imports: from __future__ import annotations
  import warnings
  from collections.abc import Iterator
  from functools import wraps
  from numbers import Number
  import numpy
  from tlz import merge
  from dask.array.core import Array
  from dask.array.numpy_compat import _numpy_122
  from dask.array.numpy_compat import percentile
  from dask.base import tokenize
  from dask.highlevelgraph import HighLevelGraph
label_desc: Use image node_id 1 for calling a global function with example usage: _percentile(a, q, method) and returns: np_percentile,  n, None,  n, pd,  n, result,  n