def check_true(expr, ex=AssertionError, msg="expr was not True"):
    """
    Raises an Exception when expr evaluates to False.

    :param expr: The expression
    :param ex: (optional, default AssertionError) exception to raise.
    :param msg: (optional) The message for the exception
    :return: True otherwise
    """
    if not bool(expr):
        raise ex(msg)
    else:
        return True