# Path: pyxmpp/exceptions.py
# class StringprepError(Error):
#     """Exception raised when string preparation results in error."""
#     pass


import stringprep
import unicodedata
from pyxmpp.exceptions import StringprepError
        return r

    def prohibit(self,s):
        """Checks for prohibited characters."""
        for c in s:
            for t in self.prohibited:
                if t.lookup(c):
                    raise StringprepError,"Prohibited character: %r" % (c,)
        return s

    def check_unassigned(self,s):
        """Checks for unassigned character codes."""
        for c in s:
            for t in self.unassigned:
                if t.lookup(c):
                    raise StringprepError,"Unassigned character: %r" % (c,)
        return s

    def check_bidi(self,s):
        """Checks if sting is valid for bidirectional printing."""
        has_l=0
        has_ral=0
        for c in s:
            if D_1.lookup(c):
                has_ral=1
            elif D_2.lookup(c):
                has_l=1
        if has_l and has_ral:
            raise StringprepError,"Both RandALCat and LCat characters present"
        if has_l and (D_1.lookup(s[0]) is None or D_1.lookup(s[-1]) is None):

# Path: pyxmpp/exceptions.py
# class StringprepError(Error):
#     """Exception raised when string preparation results in error."""
#     pass


# Path: pyxmpp/xmppstringprep.py
import stringprep
import unicodedata
from pyxmpp.exceptions import StringprepError

        return r

    def prohibit(self,s):
        """Checks for prohibited characters."""
        for c in s:
            for t in self.prohibited:
                if t.lookup(c):
                    raise StringprepError,"Prohibited character: %r" % (c,)
        return s

    def check_unassigned(self,s):
        """Checks for unassigned character codes."""
        for c in s:
            for t in self.unassigned:
                if t.lookup(c):
                    raise StringprepError,"Unassigned character: %r" % (c,)
        return s

    def check_bidi(self,s):
        """Checks if sting is valid for bidirectional printing."""
        has_l=0
        has_ral=0
        for c in s:
            if D_1.lookup(c):
                has_ral=1
            elif D_2.lookup(c):
                has_l=1
        if has_l and has_ral:
            raise StringprepError,"Both RandALCat and LCat characters present"
        if has_l and (D_1.lookup(s[0]) is None or D_1.lookup(s[-1]) is None):

            raise StringprepError,"The first and the last character must be RandALCat"