@io_hdf5.with_read_hdf5<EOL>def read_hdf5_flag(h5f, path=None, gpstype=LIGOTimeGPS):
<EOL>dataset = _get_flag_group(h5f, path)<EOL>active = SegmentList.read(dataset['<STR_LIT>'], format='<STR_LIT>',<EOL>gpstype=gpstype)<EOL>try:<EOL><INDENT>known = SegmentList.read(dataset['<STR_LIT>'], format='<STR_LIT>',<EOL>gpstype=gpstype)<EOL><DEDENT>except KeyError as first_keyerror:<EOL><INDENT>try:<EOL><INDENT>known = SegmentList.read(dataset['<STR_LIT>'], format='<STR_LIT>',<EOL>gpstype=gpstype)<EOL><DEDENT>except KeyError:<EOL><INDENT>raise first_keyerror<EOL><DEDENT><DEDENT>return DataQualityFlag(active=active, known=known, **dict(dataset.attrs))<EOL>
Read a `DataQualityFlag` object from an HDF5 file or group.