Function wrapTemplate

Wraps a template with the template key.