def METHOD_NAME(self, tmp_path, final_path):
    # There is no way to move a file and make it error if the destination
    # already exists, so use a lock instead.
    with lock:
        free_path = self._find_free_path(final_path)
        if free_path != final_path:
            LOGGER.info('Backing up {} to {}.', final_path, free_path, type='general')
            shutil.move(str(final_path), str(free_path))
        LOGGER.debug('Writing output to {}.', final_path, type='general')
        shutil.move(tmp_path, str(final_path))