async def anext(*args):
    """Return the next item from an async iterator.

    Args:
        iterable: An async iterable.
        default: An optional default value to return if the iterable is empty.

    Return:
        The next value of the iterable.

    Raises:
        TypeError: The iterable given is not async.

    This function will return the next value form an async iterable. If the
    iterable is empty the StopAsyncIteration will be propogated. However, if
    a default value is given as a second argument the exception is silenced and
    the default value is returned instead.
    """
    if not args:

        raise TypeError('anext() expected at least 1 arguments, got 0')

    if len(args) > 2:

        raise TypeError(
            'anext() expected at most 2 arguments, got {}'.format(len(args))
        )

    iterable, default, has_default = args[0], None, False
    if len(args) == 2:

        iterable, default = args
        has_default = True

    try:

        return await iterable.__anext__()

    except StopAsyncIteration as exc:

        if has_default:

            return default

        raise StopAsyncIteration() from exc
async def anext ( * args ) : if not args : raise TypeError ( 'anext() expected at least 1 arguments, got 0' ) if len ( args ) > 2 : raise TypeError ( 'anext() expected at most 2 arguments, got {}' . format ( len ( args ) ) ) iterable , default , has_default = args [ 0 ] , None , False if len ( args ) == 2 : iterable , default = args has_default = True try : return await iterable . __anext__ ( ) except StopAsyncIteration as exc : if has_default : return default raise StopAsyncIteration ( ) from exc
Return the next item from an async iterator.

    Args:
        iterable: An async iterable.
        default: An optional default value to return if the iterable is empty.

    Return:
        The next value of the iterable.

    Raises:
        TypeError: The iterable given is not async.

    This function will return the next value form an async iterable. If the
    iterable is empty the StopAsyncIteration will be propogated. However, if
    a default value is given as a second argument the exception is silenced and
    the default value is returned instead.