def _parse_content(response):
    'parse the response body as JSON, raise on errors'
    if (response.status_code != 200):
        raise ApiError(f'unknown error: {response.content.decode()}')
    result = json.loads(response.content)
    if (not result['ok']):
        raise ApiError(f"{result['error']}: {result.get('detail')}")
    return result
parse the response body as JSON, raise on errors
def _parse_content(response):
    
    if (response.status_code != 200):
        raise ApiError(f'unknown error: {response.content.decode()}')
    result = json.loads(response.content)
    if (not result['ok']):
        raise ApiError(f"{result['error']}: {result.get('detail')}")
    return result