def send_server_error(request, output_type=message.FORMAT_HTML):
    request.error(500)
    if output_type == message.FORMAT_JSON:
        data = {}
        data['status_code'] = '500 Internal Server Error'
        json_data = json.dumps(data)
        request.response.headers['Content-Type'] = 'application/json'
        request.response.out.write(json_data)
    else:
        request.response.out.write(_get_jinja_template('not_found.html').render(
        ))