def addai(argname, condition=None):
    r"""
    Add an "AI" exception in the global exception handler.

    An "AI" exception is of the type :code:`RuntimeError('Argument
    \`*[argname]*\` is not valid')` where :code:`*[argname]*` is the value of
    the **argname** argument

    :param argname: Argument name
    :type  argname: string

    :param condition: Flag that indicates whether the exception is
                      raised *(True)* or not *(False)*. If None the flag is not
                      used and no exception is raised
    :type  condition: boolean or None

    :rtype: (if condition is not given or None) function

    :raises:
     * RuntimeError (Argument \`argname\` is not valid)

     * RuntimeError (Argument \`condition\` is not valid)
    """
    # pylint: disable=C0123
    if not isinstance(argname, str):
        raise RuntimeError("Argument `argname` is not valid")
    if (condition is not None) and (type(condition) != bool):
        raise RuntimeError("Argument `condition` is not valid")
    obj = _ExObj(RuntimeError, "Argument `{0}` is not valid".format(argname), condition)
    return obj.craise
def addai ( argname , condition = None ) : if not isinstance ( argname , str ) : raise RuntimeError ( "Argument `argname` is not valid" ) if ( condition is not None ) and ( type ( condition ) != bool ) : raise RuntimeError ( "Argument `condition` is not valid" ) obj = _ExObj ( RuntimeError , "Argument `{0}` is not valid" . format ( argname ) , condition ) return obj . craise
r"""
    Add an "AI" exception in the global exception handler.

    An "AI" exception is of the type :code:`RuntimeError('Argument
    \`*[argname]*\` is not valid')` where :code:`*[argname]*` is the value of
    the **argname** argument

    :param argname: Argument name
    :type  argname: string

    :param condition: Flag that indicates whether the exception is
                      raised *(True)* or not *(False)*. If None the flag is not
                      used and no exception is raised
    :type  condition: boolean or None

    :rtype: (if condition is not given or None) function

    :raises:
     * RuntimeError (Argument \`argname\` is not valid)

     * RuntimeError (Argument \`condition\` is not valid)