async def maybe_coroutine(f: MaybeAwaitableFunc[P, T], *args: P.args, **kwargs: P.kwargs) -> T: value = f(*args, **kwargs) if _isawaitable(value): return await value else: return value # type: ignore
async def maybe_coroutine(f, *args, **kwargs): value = f(*args, **kwargs) if _isawaitable(value): return await value else: return value
async def maybe_await(x): if _isawaitable(x): return await x else: return x
def create_task(loop, f, *args, **kwargs) -> None: value = f(*args, **kwargs) if _isawaitable(value): loop.create_task(value)