event.slow_data.SafetyPLC.SPLC_CAM_Status

from enum import Enum, IntEnum, auto    
class LidStatus(Enum):
    # TODO: check the Enum docu, if this repetition of auto() can be avoided...
    Undefined = auto()
    Closed = auto()
    D2_starting = auto()
    D1_opening = auto()
    D1_opened = auto()
    D2_opening = auto()
    Opened = auto()
    D1_starting = auto()
    D2_closing = auto()
    D2_closed = auto()
    D1_closing = auto()
    OVC_error = auto()
    OVC_error_reseting = auto()
    Timeout_error = auto()
    
    @classmethod
    def from_CAM_Status(cls, status):
        # LidStatus is encoded in the 4 least significant bits of
        # the SafetyPLC.SPLC_CAM_Status
        return cls(status & 0xF)


LidStatus.from_CAM_Status(event.slow_data.SafetyPLC.SPLC_CAM_Status)

"""
Explanation: How to look at the lid_status
The lid_status is contained in the least significant 4bits of this integer
End of explanation
"""


for event in data_stream:
    lid_status = LidStatus.from_CAM_Status(event.slow_data.SafetyPLC.SPLC_CAM_Status)
    if lid_status is not LidStatus.Opened:
        continue
    else:
        # Lid is open, so we can analyze
        pass

"""
Explanation: So inside a "processor" which wants to skip all events where the Lid is not Opened the code would read like this:
End of explanation
"""


