code: def _get_counts(
      values_shape: Shape,
      mask: npt.NDArray[np.bool_] | None,
      axis: AxisInt | None,
      dtype: np.dtype[np.floating] = np.dtype(np.float64),
  ) -> np.floating | npt.NDArray[np.floating]:
      """
      Get the count of non-null values along an axis
  
      Parameters
      ----------
      values_shape : tuple of int
          shape tuple from values ndarray, used if mask is None
      mask : Optional[ndarray[bool]]
          locations in values that should be considered missing
      axis : Optional[int]
          axis to count along
      dtype : type, optional
          type to use for count
  
      Returns
      -------
      count : scalar or array
      """
      if axis is None:
          if mask is not None:
              n = mask.size - mask.sum()
          else:
              n = np.prod(values_shape)
          return dtype.type(n)
  
      if mask is not None:
          count = mask.shape[axis] - mask.sum(axis)
      else:
          count = values_shape[axis]
  
      if is_integer(count):
          return dtype.type(count)
      return count.astype(dtype, copy=False)
  
imports: from __future__ import annotations
  import functools
  import itertools
  from typing import Any, Callable, cast
  import warnings
  import numpy
  from pandas._config import get_option
  from pandas._libs import NaT, NaTType, iNaT, lib
  from pandas._typing import ArrayLike, AxisInt, CorrelationMethod, Dtype, DtypeObj, F, Scalar, Shape, npt
  from pandas.compat._optional import import_optional_dependency
  from pandas.util._exceptions import find_stack_level
  from pandas.core.dtypes.common import is_complex, is_float, is_float_dtype, is_integer, is_numeric_dtype, is_object_dtype, needs_i8_conversion, pandas_dtype
  from pandas.core.dtypes.missing import isna, na_value_for_dtype, notna
label_desc: Use image node_id 31 for calling a global function with example usage: _get_counts(values_shape, mask, axis, dtype) and returns: count, dtype, dtype