Remove dmd entirely from your script, it is already defined in locals() during the execution of your event transform. There is no need to define it yourself, just like evt is already defined.
To see for yourself, define the following one line event transform, and then use the Event Console add button to add a new event for the Event Class you just created the transform for, to quickly test:
evt.summary = str('dmd' in locals())
You should see a True placed into your event's summary, meaning dmd is already defined, and ready for use :)