def save(self, doc):
        if doc.id:
            return self.update(doc)
        else:
            return self.insert(doc)
def get(self, key, default=None):
        try:
            value = self[key]
        except KeyError:
            value = self._to_python(default)
        return value