code: def write(dataset, out, freq, type_, stream, compression):
      out = Path(out)
  
      if type_ is None:
          if out.suffix in [".feather", ".arrow"]:
              type_ = "arrow"
          elif out.suffix == ".parquet":
              type_ = "parquet"
          else:
              raise click.UsageError(
                  f"Unsupported suffix {out.suffix}."
              )
  
      if type_ == "arrow":
          writer = ArrowWriter(stream=stream, compression=compression)
      else:
          writer = ParquetWriter()
  
      writer.write_to_file(tqdm(FileDataset(dataset, freq)), out)
  
imports: from pathlib import Path
  import click
  from gluonts.dataset.common import FileDataset
  from gluonts.gluonts_tqdm import tqdm
  from .None import ArrowWriter, ParquetWriter
label_desc: Use image node_id 2 for calling a global function with example usage: write(dataset, out, freq, type_, stream, compression) without return types