import toml


def config_write(tmp_path):
    """Fixture which will write the specified data to a config file for the tool."""

    def writer(**config_data):
        (tmp_path / "pyproject.toml").write_text(
            toml.dumps(
                {"tool": {"ni-python-styleguide": config_data}},
            )
        )

    return writer