code: def mode(a, axis=0):
      """
      Returns an array of the modal (most common) value in the passed array.
  
      Parameters
      ----------
      a : array_like
          n-dimensional array of which to find mode(s).
      axis : int or None, optional
          Axis along which to operate. Default is 0. If None, compute over
          the whole array `a`.
  
      Returns
      -------
      mode : ndarray
          Array of modal values.
      count : ndarray
          Array of counts for each mode.
  
      Notes
      -----
      For more details, see `stats.mode`.
  
      Examples
      --------
      >>> from scipy import stats
      >>> from scipy.stats import mstats
      >>> m_arr = np.ma.array([1, 1, 0, 0, 0, 0], mask=[0, 0, 1, 1, 1, 0])
      >>> stats.mode(m_arr)
      ModeResult(mode=array([0]), count=array([4]))
      >>> mstats.mode(m_arr)
      ModeResult(mode=array([1.]), count=array([2.]))
  
      """
      a, axis = _chk_asarray(a, axis)
  
      def _mode1D(a):
          (rep, cnt) = find_repeats(a)
          if not cnt.ndim:
              return (0, 0)
          elif cnt.size:
              return (rep[cnt.argmax()], cnt.max())
          else:
              return (a.min(), 1)
  
      if axis is None:
          output = _mode1D(ma.ravel(a))
          output = (ma.array(output[0]), ma.array(output[1]))
      else:
          output = ma.apply_along_axis(_mode1D, axis, a)
          newshape = list(a.shape)
          newshape[axis] = 1
          slices = [slice(None)] * output.ndim
          slices[axis] = 0
          modes = output[tuple(slices)].reshape(newshape)
          slices[axis] = 1
          counts = output[tuple(slices)].reshape(newshape)
          output = (modes, counts)
  
      return ModeResult(*output)
  
imports: from __future__ import division, print_function, absolute_import
  import numpy
  from numpy import ndarray
  import numpy.ma
  from numpy.ma import masked, nomask
  from scipy._lib.six import iteritems
  import itertools
  import warnings
  from collections import namedtuple
  from .None import distributions
  import scipy.special
  from ._stats_mstats_common import _find_repeats, linregress, theilslopes, siegelslopes
label_desc: Use image node_id 8 for calling a global function with example usage: mode(a, axis) and returns: ModeResult, int,  int, rep,  cnt, a,  int