def xtext_decode(s, errors=None):
 r = []
 i = 0
 while (i < len(s)):
  if (s[i] == '+'):
   try:
    r.append(chr(int(s[(i + 1):(i + 3)], 16)))
   except ValueError:
    r.append(s[i:(i + 3)])
   i += 3
  else:
   r.append(s[i])
   i += 1
 return (''.join(r), len(s))

def xtext_decode ( s , errors = None ) : r = [ ] i = 0 while ( i < len ( s ) ) : if ( s [ i ] == '+' ) : try : r . append ( chr ( int ( s [ ( i + 1 ) : ( i + 3 ) ] , 16 ) ) ) except ValueError : r . append ( s [ i : ( i + 3 ) ] ) i += 3 else : r . append ( s [ i ] ) i += 1 return ( '' . join ( r ) , len ( s ) )
decode the xtext-encoded string c{s} .