def _adjust_lines(lines):
 formatted_lines = []
 for l in lines:
  l = l.replace('\r\n', '\n').replace('\r', '\n').strip()
  if l.lower().startswith('matrix'):
   formatted_lines.append(l)
  else:
   l = l.replace('\n', ' ')
   if l:
    formatted_lines.append(l)
 return formatted_lines

def _adjust_lines ( lines ) : formatted_lines = [ ] for l in lines : l = l . replace ( '\r\n' , '\n' ) . replace ( '\r' , '\n' ) . strip ( ) if l . lower ( ) . startswith ( 'matrix' ) : formatted_lines . append ( l ) else : l = l . replace ( '\n' , ' ' ) if l : formatted_lines . append ( l ) return formatted_lines
adjust linebreaks to match ; .