How to create template switch to a lock?

I would like to toggle my Zigbee lock, like it’s possible to do with for example light. So I read that I could create a template switch that calls lock and unlock based on the switch state.

But unfortunately I don’t understand how to do that. I read the info site at Home Assistant site (see bellow) but didn’t help me. So can someone help me with an example how it could look like to create a template switch to my lock (entity I’d: lock.danalock_v3) so that I can toggle.

Thanx in advance.