'Set multiple attributes\' values for this subject in one operation.'

def MultiSet(self, subject, values, timestamp=None, replace=True, sync=True, to_delete=None, token=None):

    to_delete = set((to_delete or []))
    subject = utils.SmartUnicode(subject)
    to_insert = []
    to_replace = []
    transaction = []
    for (attribute, sequence) in values.items():
        for value in sequence:
            if isinstance(value, tuple):
                (value, entry_timestamp) = value
            else:
                entry_timestamp = timestamp
            if (entry_timestamp is None):
                entry_timestamp = timestamp
            if (entry_timestamp is not None):
                entry_timestamp = int(entry_timestamp)
            attribute = utils.SmartUnicode(attribute)
            data = self._Encode(value)
            if (replace or (attribute in to_delete)):
                existing = self._CountExistingRows(subject, attribute)
                if existing:
                    to_replace.append([subject, attribute, data, entry_timestamp])
                else:
                    to_insert.append([subject, attribute, data, entry_timestamp])
                if (attribute in to_delete):
                    to_delete.remove(attribute)
            else:
                to_insert.append([subject, attribute, data, entry_timestamp])
    if to_delete:
        self.DeleteAttributes(subject, to_delete, token=token)
    if sync:
        if to_replace:
            transaction.extend(self._BuildReplaces(to_replace))
        if to_insert:
            transaction.extend(self._BuildInserts(to_insert))
        if transaction:
            self._ExecuteTransaction(transaction)
    else:
        if to_replace:
            with self.buffer_lock:
                self.to_replace.extend(to_replace)
        if to_insert:
            with self.buffer_lock:
                self.to_insert.extend(to_insert)
