# Buggy code
async def _retrieve_websocket_info(self):
    """Retrieves the WebSocket info from Slack.

    Returns:
        A tuple of websocket information.
        e.g.
        (
            "wss://...",
            {
                "self": {"id": "U01234ABC","name": "robotoverlord"},
                "team": {
                    "domain": "exampledomain",
                    "id": "T123450FP",
                    "name": "ExampleName"
                }
            }
        )

    Raises:
        SlackApiError: Unable to retrieve RTM URL from Slack.
    """
    if self._web_client is None:
        self._web_client = WebClient(
            token=self.token,
            base_url=self.base_url,
            ssl=self.ssl,
            proxy=self.proxy,
            run_async=True,
            loop=self._event_loop,
            session=self._session,
            headers=self.headers,
        )
    self._logger.debug("Retrieving websocket info.")
    use_rtm_start = self.connect_method in ["rtm.start", "rtm_start"]
    if self.run_async:
        if use_rtm_start:
            resp = await self._web_client.rtm_start()
        else:
            resp = await self._web_client.rtm_connect()
    else:
        if use_rtm_start:
            resp = self._web_client.rtm_start()
        else:
            resp = self._web_client.rtm_connect()

    url = resp.get("url")
    if url is None:
        msg = "Unable to retrieve RTM URL from Slack."
        raise client_err.SlackApiError(message=msg, response=resp)
    return url, resp.data


# Traceback (URLError)
`Traceback (most recent call last):`
` File "/Volumes/X5/survival_bot/Util/westland_bot/slack_bot.py", line 40, in rtm_client_run_on`
`   self.process_bots(web_client, sender, data['text'], channel, is_group_channel)`
` File "/Volumes/X5/survival_bot/Util/westland_bot/slack_bot.py", line 82, in process_bots`
`   web_client.files_upload(`
` File "/usr/local/lib/python3.8/site-packages/slack/web/client.py", line 1533, in files_upload`
`   return self.api_call("files.upload", files={"file": file}, data=kwargs)`
` File "/usr/local/lib/python3.8/site-packages/slack/web/base_client.py", line 150, in api_call`
`   return self._sync_send(api_url=api_url, req_args=req_args)`
` File "/usr/local/lib/python3.8/site-packages/slack/web/base_client.py", line 241, in _sync_send`
`   return self._urllib_api_call(`
` File "/usr/local/lib/python3.8/site-packages/slack/web/base_client.py", line 352, in _urllib_api_call`
`   response = self._perform_urllib_http_request(url=url, args=request_args)`
` File "/usr/local/lib/python3.8/site-packages/slack/web/base_client.py", line 495, in _perform_urllib_http_request`
`   raise err`
` File "/usr/local/lib/python3.8/site-packages/slack/web/base_client.py", line 475, in _perform_urllib_http_request`
`   resp = urlopen(  # skipcq: BAN-B310`
` File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 222, in urlopen`
`   return opener.open(url, data, timeout)`
` File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 525, in open`
`   response = self._open(req, data)`
` File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 542, in _open`
`   result = self._call_chain(self.handle_open, protocol, protocol +`
` File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 502, in _call_chain`
`   result = func(*args)`
` File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 1393, in https_open`
`   return self.do_open(http.client.HTTPSConnection, req,`
` File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 1353, in do_open`
`18:36`
`raise URLError(err)`
`urllib.error.URLError: <urlopen error The write operation timed out>`

# Fixed code
async def _retrieve_websocket_info(self):
    """Retrieves the WebSocket info from Slack.

    Returns:
        A tuple of websocket information.
        e.g.
        (
            "wss://...",
            {
                "self": {"id": "U01234ABC","name": "robotoverlord"},
                "team": {
                    "domain": "exampledomain",
                    "id": "T123450FP",
                    "name": "ExampleName"
                }
            }
        )

    Raises:
        SlackApiError: Unable to retrieve RTM URL from Slack.
    """
    if self._web_client is None:
        self._web_client = WebClient(
            token=self.token,
            base_url=self.base_url,
            timeout=self.timeout,
            ssl=self.ssl,
            proxy=self.proxy,
            run_async=True,
            loop=self._event_loop,
            session=self._session,
            headers=self.headers,
        )
    self._logger.debug("Retrieving websocket info.")
    use_rtm_start = self.connect_method in ["rtm.start", "rtm_start"]
    if self.run_async:
        if use_rtm_start:
            resp = await self._web_client.rtm_start()
        else:
            resp = await self._web_client.rtm_connect()
    else:
        if use_rtm_start:
            resp = self._web_client.rtm_start()
        else:
            resp = self._web_client.rtm_connect()

    url = resp.get("url")
    if url is None:
        msg = "Unable to retrieve RTM URL from Slack."
        raise client_err.SlackApiError(message=msg, response=resp)
    return url, resp.data