public function getRenderedTemplateCode(Smarty_Internal_Template $_template, $unifunc = null)
    {
        $unifunc = isset($unifunc) ? $unifunc : $this->unifunc;
        $level = ob_get_level();
        try {
            if (empty($unifunc) || !is_callable($unifunc)) {
                throw new SmartyException("Invalid compiled template for '{$_template->template_resource}'");
            }
            if (isset($_template->smarty->security_policy)) {
                $_template->smarty->security_policy->startTemplate($_template);
            }
            //
            // render compiled or saved template code
            //
            if (!isset($_template->_cache['capture_stack'])) {
                $_template->_cache['capture_stack'] = array();
            }
            $_saved_capture_level = count($_template->_cache['capture_stack']);
            $unifunc($_template);
            // any unclosed {capture} tags ?
            if ($_saved_capture_level != count($_template->_cache['capture_stack'])) {
                $_template->capture_error();
            }
            if (isset($_template->smarty->security_policy)) {
                $_template->smarty->security_policy->exitTemplate();
            }
            return null;
        }
        catch (Exception $e) {
            while (ob_get_level() > $level) {
                ob_end_clean();
            }
             if (isset($_template->smarty->security_policy)) {
                $_template->smarty->security_policy->exitTemplate();
            }
            throw $e;
        }
    }