<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def render_error( project: 'projects.Project', error: Exception, stack: typing.List[dict] = None ) -> dict: """ Renders an Exception to an error response that includes rendered text and html error messages for display. :param project: Currently open project. :param error: The SyntaxError to be rendered to html and text for display. :param stack: Optionally specify a parsed stack. If this value is None the standard Cauldron stack frames will be rendered. :return: A dictionary containing the error response with rendered display messages for both text and html output. """


    data = dict(
        type=error.__class__.__name__,
        message='{}'.format(error),
        stack=(
            stack
            if stack is not None else
            render_stack.get_formatted_stack_frame(project)
        )
    )

    return dict(
        success=False,
        error=error,
        message=templating.render_template('user-code-error.txt', **data),
        html_message=templating.render_template('user-code-error.html', **data)
    )