code: def _temporary_filenames(total):
      
      temp_files = [_get_temporary_filename('optimage-') for i in range(total)]
      yield temp_files
      for temp_file in temp_files:
          try:
              os.remove(temp_file)
          except OSError:
              # Continue in case we could not remove the file. One reason is that
              # the fail was never created.
              pass
docs: Context manager to create temporary files and remove them after use.