code: def write_txt_file(data, filename, sampling_rate=None):
      """Write data in text format.
  
      Arguments
      ---------
      data : str, list, torch.tensor, numpy.ndarray
          The data to write in the text file.
      filename : str
          Path to file where to write the data.
      sampling_rate : None
          Not used, just here for interface compatibility.
  
      Returns
      -------
      None
  
      Example
      -------
      >>> tmpdir = getfixture('tmpdir')
      >>> signal=torch.tensor([1,2,3,4])
      >>> write_txt_file(signal, tmpdir / 'example.txt')
      """
      del sampling_rate  # Not used.
      # Check if the path of filename exists
      os.makedirs(os.path.dirname(filename), exist_ok=True)
      with open(filename, "w") as fout:
          if isinstance(data, torch.Tensor):
              data = data.tolist()
          if isinstance(data, np.ndarray):
              data = data.tolist()
          if isinstance(data, list):
              for line in data:
                  print(line, file=fout)
          if isinstance(data, str):
              print(data, file=fout)
  
imports: import os
  import torch
  import logging
  import numpy
  import pickle
  import hashlib
  import csv
  import time
  import torchaudio
  import json
  import re
  from speechbrain.utils.torch_audio_backend import check_torchaudio_backend
label_desc: Use image node_id 14 for calling a global function with example usage: write_txt_file(data, filename, sampling_rate) without return types