def set_config(<EOL>self, filename="<STR_LIT>", top_level_key="<STR_LIT>", **kwargs<EOL>):
kwargs = self._format_config(kwargs)<EOL>fname = join(self.run_dir, filename)<EOL>conf = {top_level_key: kwargs}<EOL>f90nml.write(conf, fname, force=True)<EOL>return conf<EOL>
Create a configuration file for MAGICC.

Writes a fortran namelist in run_dir.

Parameters
----------
filename : str
    Name of configuration file to write

top_level_key : str
    Name of namelist to be written in the
    configuration file

kwargs
    Other parameters to pass to the configuration file. No
    validation on the parameters is performed.

Returns
-------
dict
    The contents of the namelist which was written to file