code: def _to_tarfile(self, file_generator):
          
          if file_generator.to_path_compression == "tar":
              tar_mode = "w"
          elif file_generator.to_path_compression == "tar.gz":
              tar_mode = "w:gz"
          elif file_generator.to_path_compression == 'tar.bz2':
              tar_mode = "w:bz2"
          else:
              tar_mode = "w"
  
          with tarfile.open(file_generator.to_path, mode=tar_mode) as outfile:
              for f in file_generator:
                  outpath = self._output_path(f.source, file_generator.to_format, archive=True)
                  info = tarfile.TarInfo(outpath)
                  data = f.writestr(file_generator.to_format).encode()
                  info.size = len(data)
                  outfile.addfile(tarinfo=info, fileobj=io.BytesIO(data))
docs: Convert files to tar archive.
          :return: None
          :rtype: :py:obj:`None`