def METHOD_NAME(self):
    if self.environ.get("HTTP_UPGRADE", "").lower() == "websocket":
        # Middleware may yield from the empty upgrade
        # response, confusing this method into sending "Transfer-Encoding:
        # chunked" and, in turn, this confuses some strict WebSocket
        # clients.
        if not hasattr(self.result, "__len__") and self.result is not None:
            self.result = list(self.result)
        # ws4py 0.3.4 will try to pop the websocket from the environ
        # even if it doesn't exist, causing a key error.
        self.environ.setdefault("ws4py.websocket", None)
    super().METHOD_NAME()