def save(self, doc):
        if doc.id:
            return self.update(doc)
        else:
            return self.insert(doc)
def memoized(*args):
        try:
            return stored_results[args]
        except KeyError:
            result = stored_results[args] = fn(*args)
            return result