def METHOD_NAME(self, http_context, exception):
    http_context.respond_server_error()
    stack = traceback.format_exc()
    traceback.print_exc()
    with open(os.path.dirname(__file__)+'/static/images/error.jpeg', "rb") as error_image:
        error_encoded = base64.b64encode(error_image.read()).decode()
    return f"""
    <html>
        <body>
            <style>
                body {{
                    font-family: sans-serif;
                    color: #888;
                    text-align: center;
                }}
                body pre {{
                    width: 600px;
                    text-align: left;
                    margin: auto;
                    font-family: monospace;
                }}
            </style>
            <img src="data:image/png;base64, {error_encoded}" alt="Error image" />
            <br/>
            <p>
                Server error
            </p>
            <pre>{cgi.escape(stack)}</pre>
        </body>
    </html>
    """