statemachine.py moved here from hevi_proto