def _iri_utf8_errors_handler(exc):
 bytes_as_ints = bytes_to_list(exc.object[exc.start:exc.end])
 replacements = [(u'%%%02x' % num) for num in bytes_as_ints]
 return (u''.join(replacements), exc.end)

def _iri_utf8_errors_handler ( exc ) : bytes_as_ints = bytes_to_list ( exc . object [ exc . start : exc . end ] ) replacements = [ ( u'%%%02x' % num ) for num in bytes_as_ints ] return ( u'' . join ( replacements ) , exc . end )
error handler for decoding utf-8 parts of a uri into an iri .