def METHOD_NAME(self, mapper, output_type, exc_type, input, errors):
    base_error_handler = codecs.lookup_error(errors)
    length = len(input)
    out = output_type()
    while input:
        # first try to use self.error as the error handler
        try:
            part = mapper(input, self.base_encoding, errors=self.name)
            out += part
            break  # All converted
        except exc_type as e:
            # else convert the correct part, handle error as requested and continue
            out += mapper(input[: e.start], self.base_encoding, self.name)
            replacement, pos = base_error_handler(e)
            out += replacement
            input = input[pos:]
    return out, length