code: def glom(key, count, combine):
      """Create a rule to conglomerate identical args.
  
      Examples
      ========
  
      >>> from sympy.strategies import glom
      >>> from sympy import Add
      >>> from sympy.abc import x
  
      >>> key     = lambda x: x.as_coeff_Mul()[1]
      >>> count   = lambda x: x.as_coeff_Mul()[0]
      >>> combine = lambda cnt, arg: cnt * arg
      >>> rl = glom(key, count, combine)
  
      >>> rl(Add(x, -x, 3*x, 2, 3, evaluate=False))
      3*x + 5
  
      Wait, how are key, count and combine supposed to work?
  
      >>> key(2*x)
      x
      >>> count(2*x)
      2
      >>> combine(2, x)
      2*x
      """
  
      def conglomerate(expr):
          """Conglomerate together identical args x + x -> 2x"""
          groups = sift(expr.args, key)
          counts = {
              k: sum(map(count, args)) for k, args in groups.items()
          }
          newargs = [combine(cnt, mat) for mat, cnt in counts.items()]
          if set(newargs) != set(expr.args):
              return new(type(expr), *newargs)
          else:
              return expr
  
      return conglomerate
  
file_path: sympy/sympy/strategies/rl.py
imports: from sympy.utilities.iterables import sift
  from .util import new
label_desc: Use image node_id 2 for calling a global function with example usage: glom(key, count, combine) and returns: conglomerate, new, expr