def LineEnding(lines):
 endings = {CRLF: 0, CR: 0, LF: 0}
 for line in lines:
  if line.endswith(CRLF):
   endings[CRLF] += 1
  elif line.endswith(CR):
   endings[CR] += 1
  elif line.endswith(LF):
   endings[LF] += 1
 return (sorted(endings, key=endings.get, reverse=True) or [LF])[0]

def LineEnding ( lines ) : endings = { CRLF : 0 , CR : 0 , LF : 0 } for line in lines : if line . endswith ( CRLF ) : endings [ CRLF ] += 1 elif line . endswith ( CR ) : endings [ CR ] += 1 elif line . endswith ( LF ) : endings [ LF ] += 1 return ( sorted ( endings , key = endings . get , reverse = True ) or [ LF ] ) [ 0 ]
retrieve the line ending of the original source .