input: Write a python function to flatten a nested dictionary.
  assert flatten_dict({'a': 1, 'b': {'c': 2, 'd': {'e': 3}}}) == {'a': 1, 'b.c': 2, 'b.d.e': 3}
  assert flatten_dict({'x': {'y': {'z': {'w': 4}}}, 'v': 5}) == {'x.y.z.w': 4, 'v': 5}
  assert flatten_dict({'a': {'b': 2}, 'c': {'d': {'e': {'f': 3}}}}) == {'a.b': 2, 'c.d.e.f': 3}
output: def flatten_dict(d, parent_key='', sep='.'):
      items = []
      for k, v in d.items():
          new_key = f'{parent_key}{sep}{k}' if parent_key else k
          if isinstance(v, dict):
              items.extend(flatten_dict(v, new_key, sep=sep).items())
          else:
              items.append((new_key, v))
      return dict(items)