def make_changed_file(path, env):
    def remove_file(path):
        try:
            os.remove(path)
        except OSError:
            pass

    latest = get_installable_version(version)
    new_path = remove_extension(path)
    with open(path, 'r') as templated_file:
        with open(new_path, 'w') as new_file:
            new_file.write(templated_file.read().replace(PLACEHOLDER, latest))
            env.app.connect('build-finished',
                            lambda self, *args: remove_file(new_path))
Given the path to a template file, write a new file with:
dataset/ETHPy150Open ClusterHQ/flocker/flocker/docs/version_extensions.py/make_changed_file