def _get_json_safely(response):
    """
    Check for JSON response errors, and if all clear,
    return the JSON data
    """
    json = response.json()  # get the JSON
    if "error" in json:
        raise ValueError(json["error"][0])

    return json