def _count_elements(mapping, iterable): mapping_get = mapping.get for elem in iterable: mapping[elem] = mapping_get(elem, 0) + 1
try: # Load C helper function if available from _collections import _count_elements except ImportError: pass