def find_newline(source):
 assert (not isinstance(source, unicode))
 counter = collections.defaultdict(int)
 for line in source:
  if line.endswith(CRLF):
   counter[CRLF] += 1
  elif line.endswith(CR):
   counter[CR] += 1
  elif line.endswith(LF):
   counter[LF] += 1
 return (sorted(counter, key=counter.get, reverse=True) or [LF])[0]

def find_newline ( source ) : assert ( not isinstance ( source , unicode ) ) counter = collections . defaultdict ( int ) for line in source : if line . endswith ( CRLF ) : counter [ CRLF ] += 1 elif line . endswith ( CR ) : counter [ CR ] += 1 elif line . endswith ( LF ) : counter [ LF ] += 1 return ( sorted ( counter , key = counter . get , reverse = True ) or [ LF ] ) [ 0 ]
return type of newline used in source .