code: def write_params(path, *args, **dicts):
      
      path = Path(path)
      if not path.parent.is_dir():
          path.parent.mkdir(parents=True)
      if len(args) == 1:
          d = args[0]
          with path.open('w') as f:
              for key in d:
                  f.write(key + ' = ' + str(d[key]) + '\n')
      else:
          with path.open('w') as f:
              for k, d in dicts.items():
                  f.write('[' + k + ']\n')
                  for key, val in d.items():
                      f.write(key + ' = ' + str(val) + '\n')
docs: Write parameters to file, so that it's readable by read_params.
  
      Uses INI file format.