func NewTemplate(templateStr string) (*Template, error) {
	templateCompiled, err := t.New("").Funcs(textFuncMap).Parse(templateStr)
	if err != nil {
		return nil, fmt.Errorf("unable to compile template '%s': %s", templateStr, err)
	}
	return &Template{
		templateStr:      templateStr,
		templateCompiled: templateCompiled,
	}, nil
}
NewTemplate compiles a text template and returns the result in Template struct
Parameter templateStr must follow syntax defined by text/template
package template
import (
	"bytes"
	"fmt"
	"reflect"
	"strings"
	t "text/template"
	"github.com/Aptomi/aptomi/pkg/errors"
)
type Template struct {
	templateStr      string
	templateCompiled *t.Template
}
var textFuncMap = t.FuncMap{
	"default": func(args ...interface{}) interface{} {
		if len(args) == 0 || len(args) > 2 {
			return nil
		}
		if len(args) == 1 {
			value := args[0]
			if value == nil {
				return ""
			}
			return value
		}
		arg := args[0]
		value := args[1]
		if value == nil {
			return arg
		}
		v := reflect.ValueOf(value)
		switch v.Kind() {
		case reflect.String, reflect.Slice, reflect.Array, reflect.Map:
			if v.Len() == 0 {
				return arg
			}
		case reflect.Bool:
			if !v.Bool() {
				return arg
			}
		}
		return value
	},
}