def _create_tar_file(self, directory):
        """Helper function to create a tar file."""
        text_file_path = os.path.join(directory, "test.txt")
        tar_file_path = os.path.join(directory, "test.tar.gz")
        with open(text_file_path, "w") as text_file:
            text_file.write("Float like a butterfly, sting like a bee.")

        with tarfile.open(tar_file_path, "w:gz") as tar_file:
            tar_file.add(text_file_path, arcname="test.txt")

        return text_file_path, tar_file_path
Helper function to create a tar file.
keras/src/utils/file_utils_test.py