code: def save_data_files(bs, prefix=None, directory=None):
      
      filename = 'phonon_band.dat'
      filename = '{}_phonon_band.dat'.format(prefix) if prefix else filename
      directory = directory if directory else '.'
      filename = os.path.join(directory, filename)
  
      with open(filename, 'w') as f:
          header = '#k-distance frequency[THz]\n'
          f.write(header)
  
          for band in bs.bands:
              for d, e in zip(bs.distance, band):
                  f.write('{:.8f} {:.8f}\n'.format(d, e))
              f.write('\n')
  
      return filename
docs: Write the phonon band structure data files to disk.
  
      Args:
          bs (:obj:`~pymatgen.phonon.bandstructure.PhononBandStructureSymmLine`):
              The phonon band structure.
          prefix (:obj:`str`, optional): Prefix for data file.
          directory (:obj:`str`, optional): Directory in which to save the data.
  
      Returns:
          str: The filename of the written data file.