def format_subject(subject):
 return subject.replace('\n', '\\n').replace('\r', '\\r')

def format_subject ( subject ) : return subject . replace ( '\n' , '\\n' ) . replace ( '\r' , '\\r' )
escape cr and lf characters .