code: def _mean(
      a, axis=None, dtype=None, out=None, keepdims=False, *, where=True
  ):
      arr = asanyarray(a)
  
      is_float16_result = False
  
      rcount = _count_reduce_items(
          arr, axis, keepdims=keepdims, where=where
      )
      if (
          rcount == 0
          if where is True
          else umr_any(rcount == 0, axis=None)
      ):
          warnings.warn(
              "Mean of empty slice.", RuntimeWarning, stacklevel=2
          )
  
      # Cast bool, unsigned int, and int to float64 by default
      if dtype is None:
          if issubclass(arr.dtype.type, (nt.integer, nt.bool_)):
              dtype = mu.dtype("f8")
          elif issubclass(arr.dtype.type, nt.float16):
              dtype = mu.dtype("f4")
              is_float16_result = True
  
      ret = umr_sum(arr, axis, dtype, out, keepdims, where=where)
      if isinstance(ret, mu.ndarray):
          with _no_nep50_warning():
              ret = um.true_divide(
                  ret, rcount, out=ret, casting="unsafe", subok=False
              )
          if is_float16_result and out is None:
              ret = arr.dtype.type(ret)
      elif hasattr(ret, "dtype"):
          if is_float16_result:
              ret = arr.dtype.type(ret / rcount)
          else:
              ret = ret.dtype.type(ret / rcount)
      else:
          ret = ret / rcount
  
      return ret
  
imports: import warnings
  from contextlib import nullcontext
  from numpy.core import multiarray
  from numpy.core import umath
  from numpy.core.multiarray import asanyarray
  from numpy.core import numerictypes
  from numpy.core import _exceptions
  from numpy.core._ufunc_config import _no_nep50_warning
  from numpy._globals import _NoValue
  from numpy.compat import pickle, os_fspath
label_desc: Use image node_id 9 for calling a global function with example usage: _mean(a, axis, dtype, out, keepdims) and returns: ret