code: def _count_diff_all_purpose(actual, expected):
      "Returns list of (cnt_act, cnt_exp, elem) triples where the counts differ"
      # elements need not be hashable
      s, t = list(actual), list(expected)
      m, n = len(s), len(t)
      NULL = object()
      result = []
      for i, elem in enumerate(s):
          if elem is NULL:
              continue
          cnt_s = cnt_t = 0
          for j in range(i, m):
              if s[j] == elem:
                  cnt_s += 1
                  s[j] = NULL
          for j, other_elem in enumerate(t):
              if other_elem == elem:
                  cnt_t += 1
                  t[j] = NULL
          if cnt_s != cnt_t:
              diff = _Mismatch(cnt_s, cnt_t, elem)
              result.append(diff)
  
      for i, elem in enumerate(t):
          if elem is NULL:
              continue
          cnt_t = 0
          for j in range(i, n):
              if t[j] == elem:
                  cnt_t += 1
                  t[j] = NULL
          diff = _Mismatch(0, cnt_t, elem)
          result.append(diff)
      return result
  
file_path: catboost/contrib/tools/python3/src/Lib/unittest/util.py
imports: from collections import namedtuple, Counter
  from os.path import commonprefix
label_desc: Use image node_id 8 for calling a global function with example usage: _count_diff_all_purpose(actual, expected) and returns: result