python flatten nested dict to list