code: def write(nml, nml_path, force=False, sort=False):
      if not isinstance(nml, Namelist) and isinstance(nml, dict):
          nml_in = Namelist(nml)
      else:
          nml_in = nml
      nml_in.write(nml_path, force=force, sort=sort)