def check_qdatastream(stream):
 status_to_str = {QDataStream.Ok: 'The data stream is operating normally.', QDataStream.ReadPastEnd: 'The data stream has read past the end of the data in the underlying device.', QDataStream.ReadCorruptData: 'The data stream has read corrupt data.', QDataStream.WriteFailed: 'The data stream cannot write to the underlying device.'}
 if (stream.status() != QDataStream.Ok):
  raise OSError(status_to_str[stream.status()])

def check_qdatastream ( stream ) : status_to_str = { QDataStream . Ok : 'The data stream is operating normally.' , QDataStream . ReadPastEnd : 'The data stream has read past the end of the data in the underlying device.' , QDataStream . ReadCorruptData : 'The data stream has read corrupt data.' , QDataStream . WriteFailed : 'The data stream cannot write to the underlying device.' } if ( stream . status ( ) != QDataStream . Ok ) : raise OSError ( status_to_str [ stream . status ( ) ] )
check the status of a qdatastream and raise oserror if its not ok .