<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 async def takelast(source, n):
 """Forward the last ``n`` elements from an asynchronous sequence. If ``n`` is negative, it simply terminates after iterating the source. Note: it is required to reach the end of the source before the first element is generated. """

    queue = collections.deque(maxlen=n if n > 0 else 0)
    async with streamcontext(source) as streamer:
        async for item in streamer:
            queue.append(item)
        for item in queue:
            yield item