def _response_value(self, response, json=True):
if json:<EOL><INDENT>contentType = response.headers.get("<STR_LIT:Content-Type>", "<STR_LIT>")<EOL>if not contentType.startswith(("<STR_LIT:application/json>",<EOL>"<STR_LIT>")):<EOL><INDENT>if response.status_code == <NUM_LIT:200>:<EOL><INDENT>raise CloudStackException(<EOL>"<STR_LIT>"<EOL>.format(contentType),<EOL>response=response)<EOL><DEDENT>raise CloudStackException(<EOL>"<STR_LIT>"<EOL>.format(response),<EOL>"<STR_LIT>"<EOL>.format(self.endpoint),<EOL>response=response)<EOL><DEDENT>try:<EOL><INDENT>data = response.json()<EOL><DEDENT>except ValueError as e:<EOL><INDENT>raise CloudStackException(<EOL>"<STR_LIT>"<EOL>.format(response),<EOL>"<STR_LIT>".format(e),<EOL>response=response)<EOL><DEDENT>[key] = data.keys()<EOL>data = data[key]<EOL><DEDENT>else:<EOL><INDENT>data = response.text<EOL><DEDENT>if response.status_code != <NUM_LIT:200>:<EOL><INDENT>raise CloudStackException(<EOL>"<STR_LIT>".format(<EOL>response.status_code),<EOL>data,<EOL>response=response)<EOL><DEDENT>return data<EOL>
Parses the HTTP response as a the cloudstack value.

        It throws an exception if the server didn't answer with a 200.