def json_or_text(response):
    """
    Return response JSON as python object, or text if no JSON is present.

    Args:
        response: requests.Response object
    Returns:
        dict: json as dict
        OR text: response as text.
    """
    try:
        return response.json()
    except Exception:
        return response.text