code: def get_array_special_func(f_name, xp, n_array_args):
      if is_numpy(xp):
          f = getattr(_ufuncs, f_name, None)
      elif is_torch(xp):
          f = getattr(xp.special, f_name, None)
      elif is_cupy(xp):
          import cupyx  # type: ignore[import]
  
          f = getattr(cupyx.scipy.special, f_name, None)
      elif xp.__name__ == f"{array_api_compat_prefix}.jax":
          f = getattr(xp.scipy.special, f_name, None)
      else:
          f_scipy = getattr(_ufuncs, f_name, None)
  
          def f(*args, **kwargs):
              array_args = args[:n_array_args]
              other_args = args[n_array_args:]
              array_args = [np.asarray(arg) for arg in array_args]
              out = f_scipy(*array_args, *other_args, **kwargs)
              return xp.asarray(out)
  
      return f
  
file_path: scipy/scipy/special/_support_alternative_backends.py
imports: import os
  import sys
  import functools
  import numpy
  from scipy._lib._array_api import array_namespace, is_cupy, is_torch, is_numpy
  from .None import _ufuncs
  from ._ufuncs import log_ndtr, ndtr, ndtri, erf, erfc, i0, i0e, i1, i1e, gammaln, gammainc, gammaincc, logit, expit
label_desc: Use image node_id 1 for calling a global function with example usage: get_array_special_func(f_name, xp, n_array_args) and returns: f, xp