Dumps all the data into a INI file.

    This will automatically kill anything with a '_' in the keyname, replacing it with a dot. You have been warned.

def ini_dump_hook(cfg, text: bool=False):
    """
    Dumps all the data into a INI file.

    This will automatically kill anything with a '_' in the keyname, replacing it with a dot. You have been warned.
    """
    data = cfg.config.dump()

    # Load data back into the goddamned ini file.
    ndict = {}
    for key, item in data.items():
        key = key.replace('_', '.')
        ndict[key] = item

    cfg.tmpini = configparser.ConfigParser()
    cfg.tmpini.read_dict(data)
    if not text:
        cfg.tmpini.write(cfg.fd)
    else:
        return
    cfg.reload()