def export_course_to_tarfile(course_key, filename):
 tmp_dir = mkdtemp()
 try:
  course_dir = export_course_to_directory(course_key, tmp_dir)
  compress_directory(course_dir, filename)
 finally:
  shutil.rmtree(tmp_dir, ignore_errors=True)

def export_course_to_tarfile ( course_key , filename ) : tmp_dir = mkdtemp ( ) try : course_dir = export_course_to_directory ( course_key , tmp_dir ) compress_directory ( course_dir , filename ) finally : shutil . rmtree ( tmp_dir , ignore_errors = True )
exports a course into a tar .