def basinhop_status(res):
    """
    Determine whether an optimization result was successful or not, working
    around differences in scipy < 0.17.0 and scipy >= 0.17.0.

    Parameters
    ----------
    res : OptimizeResult
        The result to parse

    Returns
    -------
    success : bool
        Whether the optimization was successful or not.
    msg : str
        The result's message.
    """
    try:
        success = res.lowest_optimization_result.success
        msg = res.lowest_optimization_result.message
    except AttributeError:
        success = 'success' in res.message[0]
        msg = res.message[0]
    return success, msg
