from functools import reduce


def sum_groups_by_key(unsummed, key_name):
    """Computes the sum of the values for a given key across multiple dicts.

    Steps through a dictionary of lists. Each list is a list of dictionaries.
    For each dictionary in a list this function computes the sum of the value
    of a given key. A dictionary with the lists replaced by the result of each
    sum calculation is returned.
    """
    def sumfn(count, item):
        return count + item.get(key_name, 0)

    summed = {k: reduce(sumfn, g, 0) for k, g in unsummed.iteritems()}
    return summed