'Generate a template based on the specified type.
:param cnxt: RPC context.
:param type_name: Name of the resource type to generate a template for.
:param template_type: the template type to generate, cfn or hot.'

def generate_template(self, cnxt, type_name, template_type='cfn'):

    self.resource_enforcer.enforce(cnxt, type_name)
    try:
        resource_class = resources.global_env().get_class(type_name)
    except exception.NotFound:
        LOG.exception('Error    loading    resource    type    %s    from    global    environment.', type_name)
        raise exception.InvalidGlobalResource(type_name=type_name)
    else:
        if (resource_class.support_status.status == support.HIDDEN):
            raise exception.NotSupported(feature=type_name)
        return resource_class.resource_to_template(type_name, template_type)
