python flatten dictionary with nested lists