def decode_key_filter(key): return util.ensure_unicode(key.lower())
def decode_value_filter(value): return util.ensure_unicode(value)
def _utf8(value): value = util.ensure_unicode(value) if hasattr(value, 'encode'): return value.encode('utf-8') return value
def encode(self, convention=None): convention = convention if convention else self.NVP_CONVENTION return nvp.dumps(util.ensure_unicode(self), key_filter=self.encode_key_filter, value_filter=self.encode_value_filter, convention=convention)