code: def save_time_series_txt(fname, dataset, fmt="%.18e"):
      """Writes a time series dataset to disk.
  
      Parameters
      ----------
      fname : string
          Path to the file in which time series should be written.
      dataset : array-like
          The dataset of time series to be saved.
      fmt : string (default: "%.18e")
          Format to be used to write each value.
  
      Examples
      --------
      >>> dataset = to_time_series_dataset([[1, 2, 3, 4], [1, 2, 3]])
      >>> save_time_series_txt("tmp-tslearn-test.txt", dataset)
  
      See Also
      --------
      load_time_series_txt : Load time series from disk
      """
      with open(fname, "w") as f:
          for ts in dataset:
              f.write(time_series_to_str(ts, fmt=fmt) + "\n")
  
imports: import warnings
  from io import StringIO
  import numpy
  from sklearn.base import TransformerMixin
  from sklearn.utils import column_or_1d
  from sklearn.utils.validation import check_is_fitted
  from tslearn.backend import instantiate_backend
  from tslearn.bases import TimeSeriesBaseEstimator
label_desc: Use image node_id 6 for calling a global function with example usage: save_time_series_txt(fname, dataset, fmt) without return types