def save(self, doc):
        if doc.id:
            return self.update(doc)
        else:
            return self.insert(doc)
def get_except(self, func, *args):
        try:
            func(*args)
        except Exception as detail:
            return detail.__class__, str(detail)