def raise_(exception=None):
    """Raises an exception. This works very similarly to the raise
    statement except it is a function and thus an expression. For
    maximum compatibility between Python 2 and 3, raise_() takes at
    most one argument and does not support the "raise from" syntax or
    the 3-argument raise statement form. See the following example use
    case, which is a frequent idiom in Ruby and Perl but is not
    possible by default in Python, due to its statement rules.

    result = do_some_work() or raise_(Exception("Error: work failed"))

    do_some_work() would be a function which returns None if it fails
    or the result if it succeeds. So the exception is raised if the
    function fails.

    """
    if exception is None:
        raise
    else:
        raise exception
