how to flatten a dictionary in python