def encode(self, input, final=False):
    return codecs.unicode_internal_encode(input, self.errors)[0]
def encode(self, input, final=False):
    return codecs.unicode_internal_encode(input, self.errors)[0]