def set(self, attr, val): """ Sets `attr` attribute to `val`, converting value to unicode string. """ etree.ElementBase.set(self, attr, fix_unicode(str(val))) return self
def __setitem__(self, idx, val): self.set(idx, fix_unicode(str(val)))