sfn_create_state_machine function

Creates a state machine