@staticmethod
def _transcode(codecfunc, input_, errors):
    """Use `codecfunc` to encode or decode the given `input`."""
    if errors != 'strict':
        raise UnicodeError('Only strict error handling is supported.')
    return codecfunc(input_), len(input_)
