code: def final_save(self, attempts):
      import pymongo
  
      try:
          self.runs.update_one(
              {"_id": self.run_entry["_id"]},
              {"$set": self.run_entry},
              upsert=True,
          )
          return
  
      except pymongo.errors.InvalidDocument:
          self.run_entry = force_bson_encodeable(self.run_entry)
          print(
              "Warning: Some of the entries of the run were not "
              "BSON-serializable!\n They have been altered such that "
              "they can be stored, but you should fix your experiment!"
              "Most likely it is either the 'info' or the 'result'.",
              file=sys.stderr,
          )
  
          with NamedTemporaryFile(
              suffix=".pickle",
              delete=False,
              prefix="sacred_mongo_fail_",
          ) as f:
              pickle.dump(self.run_entry, f)
              print(
                  "Warning: saving to MongoDB failed! "
                  "Stored experiment entry in '{}'".format(f.name),
                  file=sys.stderr,
              )
  
      raise ObserverError("Warning: saving to MongoDB failed!")
  
imports: from typing import Optional, Union
  import mimetypes
  import os.path
  import pickle
  import re
  import sys
  import time
  from tempfile import NamedTemporaryFile
  import warnings
  import sacred.optional
  from sacred.commandline_options import cli_option
  from sacred.dependencies import get_digest
  from sacred.observers.base import RunObserver
  from sacred.observers.queue import QueueObserver
  from sacred.serializer import flatten
  from sacred.utils import ObserverError, PathType
  import pkg_resources
label_desc: Use image node_id 3 for calling the QueueCompatibleMongoObserver obj's underlying member method code with example usage: obj.final_save(attempts) without return types