code: async def takewhile(source, func):
      
      iscorofunc = asyncio.iscoroutinefunction(func)
      async with streamcontext(source) as streamer:
          async for item in streamer:
              result = func(item)
              if iscorofunc:
                  result = await result
              if not result:
                  return
              yield item
docs: Forward an asynchronous sequence while a condition is met.
  
      The given function takes the item as an argument and returns a boolean
      corresponding to the condition to meet. The function can either be
      synchronous or asynchronous.