def _decode_response(response):
    """Decode the response of a request.

    :param response: response of a request.

    :return: decoded response.

    :raise Error: Raise the error given by the request.
    """
    status_code = response.status_code

    message = "Status code " + str(status_code)
    try:
      message = CraftAIClient._parse_body(response)["message"]
    except (CraftAiInternalError, KeyError, TypeError):
      pass

    if status_code in [200, 201, 204, 207]:
      return CraftAIClient._parse_body(response)
    else:
      raise CraftAIClient._get_error_from_status(status_code, message)
    return None
Decode the response of a request.

    :param response: response of a request.

    :return: decoded response.

    :raise Error: Raise the error given by the request.