code: def catch_websocket_connection_errors():
      """A context manager that translates websocket errors into ConnectionError."""
      try:
          yield
      except websocket.WebSocketConnectionClosedException as e:
          raise ConnectionError(
              "Connection already closed. SC2 probably crashed. "
              "Check the error log."
          ) from e
      except websocket.WebSocketTimeoutException as e:
          raise ConnectionError("Websocket timed out.") from e
      except socket.error as e:
          raise ConnectionError("Socket error: %s" % e) from e
  
imports: import contextlib
  import enum
  import itertools
  import os
  import socket
  import sys
  import time
  from absl import flags
  from absl import logging
  from pysc2.lib import stopwatch
  import websocket
  from s2clientprotocol import sc2api_pb2
label_desc: Use image node_id 1 for calling a global function with example usage: catch_websocket_connection_errors() without return types