code: def validate_axis(axis, ndim):
      """Validate an input to axis= keywords"""
      if isinstance(axis, (tuple, list)):
          return tuple(validate_axis(ax, ndim) for ax in axis)
      if not isinstance(axis, numbers.Integral):
          raise TypeError(
              "Axis value must be an integer, got %s" % axis
          )
      if axis < -ndim or axis >= ndim:
          raise AxisError(
              "Axis %d is out of bounds for array of dimension %d"
              % (axis, ndim)
          )
      if axis < 0:
          axis += ndim
      return axis
  
imports: from __future__ import annotations
  import contextlib
  import functools
  import itertools
  import math
  import numbers
  import warnings
  import numpy
  from tlz import concat, frequencies
  from dask.array.core import Array
  from dask.array.numpy_compat import AxisError
  from dask.base import is_dask_collection, tokenize
  from dask.highlevelgraph import HighLevelGraph
  from dask.utils import has_keyword, is_arraylike, is_cupy_type, typename
label_desc: Use image node_id 19 for calling a global function with example usage: validate_axis(axis, ndim) and returns: axis, tuple