def merge_dicts(groups):
    """Merge a sequence of dicts together into once dict.  The first
    item wins."""

    if not isinstance(groups, list):
        groups = list(groups)
    return dict(x for g in reversed(groups) for x in g.iteritems())