def write_hdf5_flag_group(flag, h5group, **kwargs):
<EOL>flag.active.write(h5group, '<STR_LIT>', **kwargs)<EOL>kwargs['<STR_LIT>'] = True<EOL>flag.known.write(h5group, '<STR_LIT>', **kwargs)<EOL>for attr in ['<STR_LIT:name>', '<STR_LIT:label>', '<STR_LIT>', '<STR_LIT:description>', '<STR_LIT>',<EOL>'<STR_LIT>']:<EOL><INDENT>value = getattr(flag, attr)<EOL>if value is None:<EOL><INDENT>continue<EOL><DEDENT>elif isinstance(value, Quantity):<EOL><INDENT>h5group.attrs[attr] = value.value<EOL><DEDENT>elif isinstance(value, UnitBase):<EOL><INDENT>h5group.attrs[attr] = str(value)<EOL><DEDENT>else:<EOL><INDENT>h5group.attrs[attr] = value<EOL><DEDENT><DEDENT>return h5group<EOL>
Write a `DataQualityFlag` into the given HDF5 group