docs: def _ensure_object_id(cls, id):
          """Checks whether the given id is an ObjectId instance, and if not wraps it."""
          if isinstance(id, ObjectId):
              return id
  
          if isinstance(id, basestring) and OBJECTIDEXPR.match(id):
              return ObjectId(id)
  
          return id