def assert_raises(ex_type, func, *args, **kwargs):
    """
    Checks that a function raises an error when given specific arguments.

    Args:
        ex_type (Exception): exception type
        func (callable): live python function

    Example:
        >>> ex_type = AssertionError
        >>> func = len
        >>> assert_raises(ex_type, assert_raises, ex_type, func, [])
        >>> assert_raises(ValueError, [].index, 0)
    """
    try:
        func(*args, **kwargs)
    except Exception as ex:
        assert isinstance(ex, ex_type), (
            'Raised %r but type should have been %r' % (ex, ex_type))
        return True
    else:
        raise AssertionError('No error was raised')