def save(self, doc):
        if doc.id:
            return self.update(doc)
        else:
            return self.insert(doc)
def chunkstring(s, n):
    return [ s[i:i+n] for i in xrange(0, len(s), n) ]