code: def count_tied_groups(x, use_missing=False):
      """
      Counts the number of tied values.
  
      Parameters
      ----------
      x : sequence
          Sequence of data on which to counts the ties
      use_missing : bool, optional
          Whether to consider missing values as tied.
  
      Returns
      -------
      count_tied_groups : dict
          Returns a dictionary (nb of ties: nb of groups).
  
      Examples
      --------
      >>> from scipy.stats import mstats
      >>> z = [0, 0, 0, 2, 2, 2, 3, 3, 4, 5, 6]
      >>> mstats.count_tied_groups(z)
      {2: 1, 3: 2}
  
      In the above example, the ties were 0 (3x), 2 (3x) and 3 (2x).
  
      >>> z = np.ma.array([0, 0, 1, 2, 2, 2, 3, 3, 4, 5, 6])
      >>> mstats.count_tied_groups(z)
      {2: 2, 3: 1}
      >>> z[[1,-1]] = np.ma.masked
      >>> mstats.count_tied_groups(z, use_missing=True)
      {2: 2, 3: 1}
  
      """
      nmasked = ma.getmask(x).sum()
      # We need the copy as find_repeats will overwrite the initial data
      data = ma.compressed(x).copy()
      (ties, counts) = find_repeats(data)
      nties = {}
      if len(ties):
          nties = dict(zip(np.unique(counts), itertools.repeat(1)))
          nties.update(dict(zip(*find_repeats(counts))))
  
      if nmasked and use_missing:
          try:
              nties[nmasked] += 1
          except KeyError:
              nties[nmasked] = 1
  
      return nties
  
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 6 for calling a global function with example usage: count_tied_groups(x, use_missing) and returns: nties