code: def atleast_nd(x, *, ndim, xp=None):
      """Recursively expand the dimension to have at least `ndim`."""
      if xp is None:
          xp = array_namespace(x)
      x = xp.asarray(x)
      if x.ndim < ndim:
          x = xp.expand_dims(x, axis=0)
          x = atleast_nd(x, ndim=ndim, xp=xp)
      return x
  
imports: from __future__ import annotations
  import os
  import warnings
  import numpy
  from scipy._lib import array_api_compat
  from scipy._lib.array_api_compat import is_array_api_obj, size, numpy
label_desc: Use image node_id 5 for calling a global function with example usage: atleast_nd(x) and returns: x