def get_response_json(res):
    """
    Very simple function to return json from a response or raise an error if
    it is not present. Used with the metadata functions.
    """
    res_json = None
    try:
        res_json = res.json()
    except Exception:
        raise Exception(
            'Cannot get json for request to %s. Status code: %s. Response text: %s'
             % (res.url, res.status_code, res.text))
    return res_json
