def setup_config(quiz_name):
    """Updates the config.toml index and dataset field with the formatted
    quiz_name. This directs metapy to use the correct files

    Keyword arguments:
        quiz_name -- the name of the quiz

    Returns:
        True on success, false if fials to open file
    """
    try:
        conf_file = open("config.toml", 'r')
        lines = conf_file.readlines()
        conf_file.close()

        for i in range(len(lines)):
            if lines[i].startswith("index"):
                lines[i] = "index = 'idx-{0}'\n".format(quiz_name.replace(" ", "_"))
            if lines[i].startswith("dataset"):
                lines[i] = "dataset = '{0}'\n".format(quiz_name.replace(" ", "_"))

        conf_file = open("config.toml", 'w')
        with conf_file:
            conf_file.writelines(lines)
    except Exception as e:
        print(e)
        return False
    return True