send an error response including a backtrace to the client

def send_exception(self, code, exc_info=None, headers=None):
        "send an error response including a backtrace to the client"
        if headers is None:
            headers = {}

        if not exc_info:
            exc_info = sys.exc_info()

        self.send_error_msg(code,
                            traceback.format_exception(*exc_info),
                            headers)