(self, *args)
Strip characters, which are not allowed according:
            http://www.w3.org/TR/2006/REC-xml-20060816/#charsets
            From spec:
            Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]  /* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */
Strip characters, which are not allowed according:
            http://www.w3.org/TR/2006/REC-xml-20060816/#charsets
            From spec:
            Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]  /* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */
Strip characters which are not allowed according : http : // www . w3 . org / TR / 2006 / REC - xml - 20060816 / #charsets From spec : Char :: = #x9 | #xA | #xD | [ #x20 - #xD7FF ] | [ #xE000 - #xFFFD ] | [ #x10000 - #x10FFFF ] / * any Unicode character excluding the surrogate blocks FFFE and FFFF . * /
def _strip_characters(self, *args):
        """ Strip characters, which are not allowed according:
            http://www.w3.org/TR/2006/REC-xml-20060816/#charsets
            From spec:
            Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]  /* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */
        """
        regexp = r'[\x00-\x08]|[\x0b-\x0c]|[\x0e-\x1f]'
        result=[]
        for item in args:
            item_type = type(item)
            if item_type == StringType or item_type == UnicodeType:
                item = re.sub(regexp, '', item)
            elif item_type == TupleType:
                item = tuple(map(self._strip_characters, item))
            elif item_type == ListType:
                item = map(self._strip_characters, item)
            elif item_type == DictType or item_type == DictionaryType:
                item = dict([(self._strip_characters(name, val)) for name, val in item.iteritems()])
            # else: some object - should take care of himself
            #        numbers - are safe
            result.append(item)
        if len(result) == 1:
            return result[0]
        else:
            return tuple(result)
def _strip_characters ( self , * args ) : regexp = r'[\x00-\x08]|[\x0b-\x0c]|[\x0e-\x1f]' result = [ ] for item in args : item_type = type ( item ) if item_type == StringType or item_type == UnicodeType : item = re . sub ( regexp , '' , item ) elif item_type == TupleType : item = tuple ( map ( self . _strip_characters , item ) ) elif item_type == ListType : item = map ( self . _strip_characters , item ) elif item_type == DictType or item_type == DictionaryType : item = dict ( [ ( self . _strip_characters ( name , val ) ) for name , val in item . iteritems ( ) ] ) # else: some object - should take care of himself #        numbers - are safe result . append ( item ) if len ( result ) == 1 : return result [ 0 ] else : return tuple ( result )