code: def _get_response_json(self, res):
          
  
          try:
              error = res.json()
          except ValueError:
              error = {
                  "message": "The API did not respond with JSON, but: {0}".format(res.text[:1000]),
                  "error_code": "{0}".format(res.status_code)
              }
          return error
docs: Helper function to extract the JSON body out of a response OR throw an exception.
  
          :param res: the response from a request
          :return: the JSON body OR throws an exception