async def _handle_response(self, response: aiohttp.client_reqrep.ClientResponse, await_final_result: bool) -> dict:
try:<EOL><INDENT>data = await response.json()<EOL><DEDENT>except aiohttp.client_exceptions.ContentTypeError:<EOL><INDENT>text = await response.text()<EOL>logging.debug('<STR_LIT>'.format(text))<EOL>raise CloudStackClientException(message="<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>data = self._transform_data(data)<EOL>if response.status != <NUM_LIT:200>:<EOL><INDENT>raise CloudStackClientException(message="<STR_LIT>",<EOL>error_code=data.get("<STR_LIT>", response.status),<EOL>error_text=data.get("<STR_LIT>"),<EOL>response=data)<EOL><DEDENT><DEDENT>while await_final_result and ('<STR_LIT>' in data):<EOL><INDENT>await asyncio.sleep(self.async_poll_latency)<EOL>data = await self.queryAsyncJobResult(jobid=data['<STR_LIT>'])<EOL>if data['<STR_LIT>']:  <EOL><INDENT>if not data['<STR_LIT>']:  <EOL><INDENT>try:<EOL><INDENT>return data['<STR_LIT>']<EOL><DEDENT>except KeyError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>logging.debug("<STR_LIT>".format(str(data)))<EOL>raise CloudStackClientException(message="<STR_LIT>",<EOL>error_code=data.get("<STR_LIT>"),<EOL>error_text=data.get("<STR_LIT>"),<EOL>response=data)<EOL><DEDENT><DEDENT>return data<EOL>
Handles the response returned from the CloudStack API. Some CloudStack API are implemented asynchronous, which
means that the API call returns just a job id. The actually expected API response is postponed and a specific
asyncJobResults API has to be polled using the job id to get the final result once the API call has been
processed.

:param response: The response returned by the aiohttp call.
:type response: aiohttp.client_reqrep.ClientResponse
:param await_final_result: Specifier that indicates whether the function should poll the asyncJobResult API
                           until the asynchronous API call has been processed
:type await_final_result: bool
:return: Dictionary containing the JSON response of the API call
:rtype: dict