How to determine the number of engines using SimConnect

I’m using the SimConnect Python API to read and display SimVars, among which the engine parameters. Many of these are indexed variables, so instead of requesting GENERAL_ENG_RPM you have to request GENERAL_ENG_RPM:1, GENERAL_ENG_RPM:2 etc. However, how do I determine, using the SimConnect API, how many engines there are?

Simulation Variable Description Units Settable Multiplayer
NUMBER OF ENGINES Number of engines (minimum 0, maximum 4) Number N -

Thank you, exactly what I was looking for.