处理异步生成器

def handle_async_gen(gen: Any, gen_obj: Any) -> Any:
    """
    处理异步生成器
    """
    if gen is None:
        return None
    if asyncio.iscoroutine(gen):
        try:
            temp = yield from gen
            gen_obj.send(temp)
            return
        except Exception as error:
            try:
                gen = gen_obj.throw(error)
                return (yield from handle_async_gen(gen, gen_obj))
            except StopIteration:
                return None
    else:
        return gen