def safe_readline(handle):
 line = handle.readline()
 if (not line):
  raise ValueError('Unexpected end of stream.')
 return line

def safe_readline ( handle ) : line = handle . readline ( ) if ( not line ) : raise ValueError ( 'Unexpected end of stream.' ) return line
safe_readline -> line read a line from an undohandle and return it .