code: def dump_course(self, courseid):
          
          filepath = os.path.join(self.backup_dir, courseid, datetime.datetime.now().strftime("%Y%m%d.%H%M%S") + ".zip")
  
          if not os.path.exists(os.path.dirname(filepath)):
              os.makedirs(os.path.dirname(filepath))
  
          with zipfile.ZipFile(filepath, "w", allowZip64=True) as zipf:
              aggregations = self.database.aggregations.find({"courseid": courseid})
              zipf.writestr("aggregations.json", bson.json_util.dumps(aggregations), zipfile.ZIP_DEFLATED)
  
              user_tasks = self.database.user_tasks.find({"courseid": courseid})
              zipf.writestr("user_tasks.json", bson.json_util.dumps(user_tasks), zipfile.ZIP_DEFLATED)
  
              submissions = self.database.submissions.find({"courseid": courseid})
              zipf.writestr("submissions.json", bson.json_util.dumps(submissions), zipfile.ZIP_DEFLATED)
  
              submissions.rewind()
  
              for submission in submissions:
                  for key in ["input", "archive"]:
                      if key in submission and type(submission[key]) == bson.objectid.ObjectId:
                          infile = self.submission_manager.get_gridfs().get(submission[key])
                          zipf.writestr(key + "/" + str(submission[key]) + ".data", infile.read(), zipfile.ZIP_DEFLATED)
  
          self._logger.info("Course %s dumped to backup directory.", courseid)
          self.wipe_course(courseid)
docs: Create a zip file containing all information about a given course in database and then remove it from db