Automated certification
If user in state OK and time since last event is greater than {ok_to_pc_time}, then set user state to PRE_CERTIFY.
If user in state PRE_CERTIFY and time since last OK event is greater than {ok_to_c_time}, then set user state to CERTIFY.
It may be worth using a state machine to restrict and govern state transitions and associated actions. https://python-statemachine.readthedocs.io/en/latest/