python flatten dictionary recursively