human
Solve the following python programming problem given the following code:
@pytest.fixture()
def write_config_file(tmpdir):
assistant
#Here is the Python program you requested.

    """Returns a function that writes a config file.
    """
    def _write(config, data, scope):
        config_yaml = tmpdir.join(scope, (config + '.yaml'))
        config_yaml.ensure()
        with config_yaml.open('w') as f:
            yaml.dump(data, f)
    return _write