'Return the contents as regular dict.  If `flat` is `True` the
returned dict will only have the first item present, if `flat` is
`False` all values will be returned as lists.
:param flat: If set to `False` the dict returned will have lists
with all the values in it.  Otherwise it will only
contain the first item for each key.
:return: a :class:`dict`'

def to_dict(self, flat=True):

    rv = {}
    for d in reversed(self.dicts):
        rv.update(d.to_dict(flat))
    return rv
