python flatten nested list of dictionaries