code: def dict_expand(o):
          
          r = {}
          for k, v in o.items():
              if isinstance(k, str):
                  k = k.replace('$', '_')
              if "." in k:
                  sub_r, keys = r, k.split('.')
                  # create sub-dicts until last part of key
                  for k2 in keys[:-1]:
                      sub_r[k2] = {}
                      sub_r = sub_r[k2]  # descend
                      # assign last part of key to value
                  sub_r[keys[-1]] = v
              else:
                  r[k] = v
          return r
docs: Expand keys in a dict with '.' in them into
          sub-dictionaries, e.g.
  
          {'a.b.c': 'foo'} ==> {'a': {'b': {'c': 'foo'}}}