def escape_new_line(original):
 return smart_decode(original).replace(u'\\', u'\\\\').replace(u'\r', u'\\r').replace(u'\n', u'\\n')

def escape_new_line ( original ) : return smart_decode ( original ) . replace ( u'\\' , u'\\\\' ) . replace ( u'\r' , u'\\r' ) . replace ( u'\n' , u'\\n' )
replaces new line characters by a backslash followed by a n .