def pull_cfg_from_parameters_out(parameters_out, namelist_to_read="<STR_LIT>"):
single_cfg = Namelist({namelist_to_read: {}})<EOL>for key, value in parameters_out[namelist_to_read].items():<EOL><INDENT>if "<STR_LIT>" in key:<EOL><INDENT>single_cfg[namelist_to_read][key] = "<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>if isinstance(value, str):<EOL><INDENT>single_cfg[namelist_to_read][key] = value.strip("<STR_LIT>").replace(<EOL>"<STR_LIT:\x00>", "<STR_LIT>"<EOL>)<EOL><DEDENT>elif isinstance(value, list):<EOL><INDENT>clean_list = [v.strip("<STR_LIT>").replace("<STR_LIT:\x00>", "<STR_LIT>") for v in value]<EOL>single_cfg[namelist_to_read][key] = [v for v in clean_list if v]<EOL><DEDENT>else:<EOL><INDENT>assert isinstance(value, Number)<EOL>single_cfg[namelist_to_read][key] = value<EOL><DEDENT><DEDENT>except AttributeError:<EOL><INDENT>if isinstance(value, list):<EOL><INDENT>assert all([isinstance(v, Number) for v in value])<EOL>single_cfg[namelist_to_read][key] = value<EOL><DEDENT>else:<EOL><INDENT>raise AssertionError(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>return single_cfg<EOL>
Pull out a single config set from a parameters_out namelist.

    This function returns a single file with the config that needs to be passed to
    MAGICC in order to do the same run as is represented by the values in
    ``parameters_out``.

    Parameters
    ----------
    parameters_out : dict, f90nml.Namelist
        The parameters to dump

    namelist_to_read : str
        The namelist to read from the file.

    Returns
    -------
    :obj:`f90nml.Namelist`
        An f90nml object with the cleaned, read out config.

    Examples
    --------
    >>> cfg = pull_cfg_from_parameters_out(magicc.metadata["parameters"])
    >>> cfg.write("/somewhere/else/ANOTHERNAME.cfg")