title: How to take decision in a state-machine
body: <p>I'm building a state-machine based on <a href="https://github.com/pytransitions/transitions" rel="nofollow noreferrer">transitions</a> but probably a generic state-machine question. I'm struggling to build a simple decision tree.</p>
  
  <p>The simplified state-machine should look like</p>
  
  <pre><code>[state:new] --- generateXYZ ---&gt; [state:generation_successful]
                              ---&gt; [state:generation_failed]
  </code></pre>
  
  <p>I understand that I could create two transitions and guard them but that doesn't feel like the ideal solution - maybe you correct me on that one. </p>
  
  <p>Ideally I'd like to run some code and it's either returning true (=successful) or false(=failed).</p>
  
  <p>Looking forward to any advice, maybe I'm looking at this from the wrong angle. Thanks!</p>