code: def _group_poles(poles, tol, rtype):
      if rtype in ["max", "maximum"]:
          reduce = np.max
      elif rtype in ["min", "minimum"]:
          reduce = np.min
      elif rtype in ["avg", "mean"]:
          reduce = np.mean
      else:
          raise ValueError(
              "`rtype` must be one of "
              "{'max', 'maximum', 'min', 'minimum', 'avg', 'mean'}"
          )
  
      unique = []
      multiplicity = []
  
      pole = poles[0]
      block = [pole]
      for i in range(1, len(poles)):
          if abs(poles[i] - pole) <= tol:
              block.append(pole)
          else:
              unique.append(reduce(block))
              multiplicity.append(len(block))
              pole = poles[i]
              block = [pole]
  
      unique.append(reduce(block))
      multiplicity.append(len(block))
  
      return np.asarray(unique), np.asarray(multiplicity)
  
imports: import operator
  import math
  import timeit
  from scipy.spatial import cKDTree
  from .None import sigtools, dlti
  from ._upfirdn import upfirdn, _output_len, _upfirdn_modes
  from scipy import linalg, fft
  from scipy.fft._helper import _init_nd_shape_and_axes
  from scipy._lib._util import prod
  import numpy
  from scipy.special import lambertw
  from .windows import get_window
  from ._arraytools import axis_slice, axis_reverse, odd_ext, even_ext, const_ext
  from .filter_design import cheby1, _validate_sos
  from .fir_filter_design import firwin
  from ._sosfilt import _sosfilt
  import warnings
label_desc: Use image node_id 39 for calling a global function with example usage: _group_poles(poles, tol, rtype) and returns: np,  np