def raises(exception, f, *args, **kwargs):
    """
    Determine whether the given call raises the given exception.
    """
    try:
        f(*args, **kwargs)
    except exception:
        return 1
    return 0

    Determine whether the given call raises the given exception.
    
stackoverflow/venv/lib/python3.6/site-packages/twisted/python/util.py