code: def _response_value(self, response, json=True):
          
          if json:
              contentType = response.headers.get("Content-Type", "")
              if not contentType.startswith(("application/json",
                                             "text/javascript")):
                  if response.status_code == 200:
                      raise CloudStackException(
                          "JSON (application/json) was expected, got {!r}"
                          .format(contentType),
                          response=response)
  
                  raise CloudStackException(
                      "HTTP {0.status_code} {0.reason}"
                      .format(response),
                      "Make sure endpoint URL {!r} is correct."
                      .format(self.endpoint),
                      response=response)
  
              try:
                  data = response.json()
              except ValueError as e:
                  raise CloudStackException(
                      "HTTP {0.status_code} {0.reason}"
                      .format(response),
                      "{0!s}. Malformed JSON document".format(e),
                      response=response)
  
              [key] = data.keys()
              data = data[key]
          else:
              data = response.text
  
          if response.status_code != 200:
              raise CloudStackException(
                  "HTTP {0} response from CloudStack".format(
                      response.status_code),
                  data,
                  response=response)
  
          return data
docs: Parses the HTTP response as a the cloudstack value.
  
          It throws an exception if the server didn't answer with a 200.