code: def save_data_files(vr, bs, prefix=None, directory=None):
      
      filename = '{}_band.dat'.format(prefix) if prefix else 'band.dat'
      directory = directory if directory else '.'
      filename = os.path.join(directory, filename)
  
      if bs.is_metal():
          zero = vr.efermi
      else:
          zero = bs.get_vbm()['energy']
  
      with open(filename, 'w') as f:
          header = '#k-distance eigenvalue[eV]\n'
          f.write(header)
  
          # write the spin up eigenvalues
          for band in bs.bands[Spin.up]:
              for d, e in zip(bs.distance, band):
                  f.write('{:.8f} {:.8f}\n'.format(d, e - zero))
              f.write('\n')
  
          # calculation is spin polarised, write spin down bands at end of file
          if bs.is_spin_polarized:
              for band in bs.bands[Spin.down]:
                  for d, e in zip(bs.distance, band):
                      f.write('{:.8f} {:.8f}\n'.format(d, e - zero))
                  f.write('\n')
      return filename
docs: Write the band structure data files to disk.
  
      Args:
          vs (`Vasprun`): Pymatgen `Vasprun` object.
          bs (`BandStructureSymmLine`): Calculated band structure.
          prefix (`str`, optional): Prefix for data file.
          directory (`str`, optional): Directory in which to save the data.
  
      Returns:
          The filename of the written data file.