code: func prepareArg(value reflect.Value, argType reflect.Type) (reflect.Value, error) {
  	if !value.IsValid() {
  		if !canBeNil(argType) {
  			return reflect.Value{}, fmt.Errorf("value is nil; should be of type %s", argType)
  		}
  		value = reflect.Zero(argType)
  	}
  	if !value.Type().AssignableTo(argType) {
  		return reflect.Value{}, fmt.Errorf("value has type %s; should be %s", value.Type(), argType)
  	}
  	return value, nil
  }
docs: // prepareArg checks if value can be used as an argument of type argType, and
  // converts an invalid value to appropriate zero if possible.
  //
  // Copied from Go stdlib src/text/template/funcs.go.