<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">import operator

from collections import Counter
from functools import reduce
from typing import Dict, Tuple


def add_dicts(*args: Tuple[Dict, ...]) -&gt; Dict:
    """
    Adds two or more dicts together. Common keys will have their values added.

    For example::

        &gt;&gt;&gt; t1 = {'a':1, 'b':2}
        &gt;&gt;&gt; t2 = {'b':1, 'c':3}
        &gt;&gt;&gt; t3 = {'d':4}

        &gt;&gt;&gt; add_dicts(t1, t2, t3)
        {'a': 1, 'c': 3, 'b': 3, 'd': 4}

    """

    counters = [Counter(arg) for arg in args]
    return dict(reduce(operator.add, counters))
</pre></body></html>