Python API for declaring state machine metadata and putting it to use