#NEWLINE# def _split( self , data , separator = None ) : #NEWLINE# #INDENT# ' Take some data and split up based on the notion that a sentence\n            looks something like:\n            $x,y,z or $x,y,z*ab\n\n            separator is for cases where there is something strange or\n            non-standard as a separator between sentences.\n            Without this, there is no real way to tell whether:\n            $x,y,zSTUFF\n            is legal or if STUFF should be stripped.\n        ' #NEWLINE# sentences = data . split ( '$' ) #NEWLINE# clean_sentences = [ ] #NEWLINE# for item in sentences : #NEWLINE# #INDENT# cleaned_item = item . rstrip ( ) #NEWLINE# if separator : #NEWLINE# #INDENT# cleaned_item = cleaned_item . rstrip ( separator ) #NEWLINE# #UNINDENT# if ( '*' in cleaned_item . split ( ',' ) [ ( - 1 ) ] ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# ( first , checksum ) = cleaned_item . split ( '*' ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# cleaned_item = '*' . join ( [ first , checksum [ : 2 ] ] ) #NEWLINE# #UNINDENT# if cleaned_item : #NEWLINE# #INDENT# clean_sentences . append ( cleaned_item ) #NEWLINE# #UNINDENT# #UNINDENT# return clean_sentences