def save(self, doc):
        if doc.id:
            return self.update(doc)
        else:
            return self.insert(doc)
def local_rank(self) -> int:
        return 0 if self._local_rank is None else self._local_rank