def _decode_result(response, decoders=None):
    """
    Given an HTTP response, return the decoded Core API document.
    """
    if response.content:
        # Content returned in response. We should decode it.
        content_type = response.headers.get('content-type')
        codec = negotiate_decoder(content_type, decoders=decoders)
        result = codec.load(response.content, base_url=response.url)
    else:
        # No content returned in response.
        result = None

    # Coerce 4xx and 5xx codes into errors.
    is_error = response.status_code >= 400 and response.status_code <= 599
    if is_error and not isinstance(result, Error):
        result = _coerce_to_error(result, default_title=response.reason)

    return result
dataset/ETHPy150Open core-api/python-client/coreapi/transports/http.py/_decode_result/original