(cls, raw)
Escapes the value of *raw*.

        >>> TS3Escape.escape(None)
        ''
        >>> TS3Escape.escape(2)
        '2'
        >>> TS3Escape.escape(True)
        '1'
        >>> TS3Escape.escape('Hello World')
        'Hello\\sWorld'

        :arg raw: The value to escape.
        :type raw: None, str, bool, int or RawParameter

        :return: The escaped value of *raw*
        :rtype: string

        :raises TypeError: If *raw* has an unsupported type.
Escapes the value of *raw*.
Escapes the value of * raw * .
def escape(cls, raw):
        """
        Escapes the value of *raw*.

        >>> TS3Escape.escape(None)
        ''
        >>> TS3Escape.escape(2)
        '2'
        >>> TS3Escape.escape(True)
        '1'
        >>> TS3Escape.escape('Hello World')
        'Hello\\sWorld'

        :arg raw: The value to escape.
        :type raw: None, str, bool, int or RawParameter

        :return: The escaped value of *raw*
        :rtype: string

        :raises TypeError: If *raw* has an unsupported type.
        """
        if raw is None:
            return str()
        elif isinstance(raw, bool):
            return "1" if raw else "0"
        elif isinstance(raw, int):
            return str(raw)
        elif isinstance(raw, str):
            # The order of the replacement is not trivial.
            for char, repl_char in cls._MAP:
                raw = raw.replace(char, repl_char)
            return raw
        elif isinstance(raw, RawParameter):
            return str(raw)
        else:
            raise TypeError("*raw* has to be a string.")
def escape ( cls , raw ) : if raw is None : return str ( ) elif isinstance ( raw , bool ) : return "1" if raw else "0" elif isinstance ( raw , int ) : return str ( raw ) elif isinstance ( raw , str ) : # The order of the replacement is not trivial. for char , repl_char in cls . _MAP : raw = raw . replace ( char , repl_char ) return raw elif isinstance ( raw , RawParameter ) : return str ( raw ) else : raise TypeError ( "*raw* has to be a string." )