Quality flag layer (OLCI)

Please, I’ve been reading documents about the quality flag OLCI/Sensor: Level 1 and Level 2 (L2 after having processed C2RCC, SNAP).
I found some information (link below), but even with those informations I’m still trying to figure out the the logic of building and unpacking flags.
Please, would there be a document that could help me with this?

https://sentinels.copernicus.eu/documents/247904/1872756/Sentinel-3-OLCI-Product-Data-Format-Specification-OLCI-Level-1.pdf/a5ce2d77-4a4d-49bf-909e-25968944b3b4?t=1611070901270

What do you need exactly, how to use them or how to decode them?
decode_OLCI_L2_flags (1.5 KB)

With SNAP I can handle the flags properly. However, I need to understand how to decode them ( I’m implementing a python routine).

I put the python function in my previous message. This one is for L2 flags. I can share C2RCC flag decoding too,

It would be great! Thank you!

c2rcc_flags_decode.py (736 Bytes)