def normalizeNewline(text):
 text = text.replace('\r\n', '\n')
 text = text.replace('\r', '\n')
 return NEWLINES_REGEX.sub('\n', text)

def normalizeNewline ( text ) : text = text . replace ( '\r\n' , '\n' ) text = text . replace ( '\r' , '\n' ) return NEWLINES_REGEX . sub ( '\n' , text )
replace windows and mac newlines with unix newlines .