""" Exception when bidirectional requirements are not satisfied """

""" Exception when a disallowed or unallocated codepoint is used """

""" Exception when the codepoint is not valid in the context it is used """

    # Bidi rules should only be applied if string contains RTL characters
    
            # String likely comes from a newer version of Unicode
            
'Invalid direction for codepoint at position {} in a right-to-left label'

'Invalid direction for codepoint at position {} in a left-to-right label'

"""Re-map the characters in the string according to UTS46 processing."""

'should pass a unicode string to the function rather than a byte string.'

    """ Base exception for all IDNA-encoding related problems """

    """ Exception when bidirectional requirements are not satisfied """

    """ Exception when a disallowed or unallocated codepoint is used """

    """ Exception when the codepoint is not valid in the context it is used """

            raise ValueError('Unknown character in unicodedata')

    return intranges_contain(ord(cp), idnadata.scripts[script])

def valid_string_length(label: Union[bytes, str], trailing_dot: bool) -> bool:

            raise IDNABidiError('Unknown directionality in label {} at position {}'.format(repr(label), idx))

        raise IDNABidiError('First codepoint in label {} must be directionality L, R or AL'.format(repr(label)))

            if not direction in ['R', 'AL', 'AN', 'EN', 'ES', 'CS', 'ET', 'ON', 'BN', 'NSM']:

                raise IDNABidiError('Invalid direction for codepoint at position {} in a right-to-left label'.format(idx))

                        raise IDNABidiError('Can not mix numeral types in a right-to-left label')

            if not direction in ['L', 'EN', 'ES', 'CS', 'ET', 'ON', 'BN', 'NSM']:

                raise IDNABidiError('Invalid direction for codepoint at position {} in a left-to-right label'.format(idx))

        raise IDNABidiError('Label ends with illegal codepoint directionality')

        raise IDNAError('Label begins with an illegal combining character')

        raise IDNAError('Label has disallowed hyphens in 3rd and 4th position')

        raise IDNAError('Label must not start or end with a hyphen')

        raise IDNAError('Label must be in Normalization Form C')

            if _combining_class(ord(label[pos - 1])) == _virama_combining_class:

            joining_type = idnadata.joining_types.get(ord(label[i]))

def valid_contexto(label: str, pos: int, exception: bool = False) -> bool:

            if ord(label[pos - 1]) == 0x006c and ord(label[pos + 1]) == 0x006c:

            if _is_script(cp, 'Hiragana') or _is_script(cp, 'Katakana') or _is_script(cp, 'Han'):

        if intranges_contain(cp_value, idnadata.codepoint_classes['PVALID']):

        elif intranges_contain(cp_value, idnadata.codepoint_classes['CONTEXTJ']):

                    raise InvalidCodepointContext('Joiner {} not allowed at position {} in {}'.format(

                raise IDNAError('Unknown codepoint adjacent to joiner {} at position {} in {}'.format(

        elif intranges_contain(cp_value, idnadata.codepoint_classes['CONTEXTO']):

                raise InvalidCodepointContext('Codepoint {} not allowed at position {} in {}'.format(_unot(cp_value), pos+1, repr(label)))

            raise InvalidCodepoint('Codepoint {} at position {} of {} not allowed'.format(_unot(cp_value), pos+1, repr(label)))

            raise IDNAError('Malformed A-label, no Punycode eligible content found')

            raise IDNAError('A-label must not end with a hyphen')

def uts46_remap(domain: str, std3_rules: bool = True, transitional: bool = False) -> str:

    """Re-map the characters in the string according to UTS46 processing."""

            uts46row = uts46data[code_point if code_point < 256 else

                bisect.bisect_left(uts46data, (code_point, 'Z')) - 1]

                    (status == '3' and not std3_rules and replacement is None)):

                'Codepoint {} not allowed at position {} in {}'.format(

def encode(s: Union[str, bytes, bytearray], strict: bool = False, uts46: bool = False, std3_rules: bool = False, transitional: bool = False) -> bytes:

            raise IDNAError('should pass a unicode string to the function rather than a byte string.')

def decode(s: Union[str, bytes, bytearray], strict: bool = False, uts46: bool = False, std3_rules: bool = False) -> str: