What you have is fine, but small suggestion: There is a short-cut to define/undefine directly from the <code>VMXML</code> instance.  So if you save the instance from the "output_shut" line, you could just call <code>.define()</code> on it.