#NEWLINE# def lf_to_crlf( text ) : #NEWLINE# #INDENT# nb_subst = 1 #NEWLINE# while nb_subst : #NEWLINE# #INDENT# ( text , nb_subst ) = re . subn ( '(^|[^\r])\n' , '\\1\r\n' , text ) #NEWLINE# #UNINDENT# return nb_subst