python flatten nested dict with lists