docs: def replace_blocks(self, blocks):
          """Replace multiple blocks. blocks must be a list of tuples where
          each tuple consists of (namespace, offset, key, data)"""
          start = 0
          bulk_insert = self.bulk_insert
          blocks_len = len(blocks)
          row = '(%s,%s,%s,%s,%s)'
          query = 'REPLACE INTO gauged_data (namespace, offset, `key`, ' \
              'data, flags) VALUES '
          execute = self.cursor.execute
          to_buffer = self.to_buffer
          while start < blocks_len:
              rows = blocks[start:start+bulk_insert]
              params = []
              for namespace, offset, key, data, flags in rows:
                  params.extend((namespace, offset, key, to_buffer(data), flags))
              insert = (row + ',') * (len(rows) - 1) + row
              execute(query + insert, params)
              start += bulk_insert