inspectisawaitable
inspect.isawaitable is a function in Python’s standard library (the inspect module) that determines whether a given object can be used in an await expression. It was introduced as part of the asyncio integration in Python 3.5 and remains a common helper when writing dynamic or generic asynchronous code.
Behavior and semantics: isawaitable(obj) returns True if obj is a coroutine object or if it defines an
Usage: The function is used to probe an object before awaiting it, or to adapt code paths
Limitations: isawaitable is a best-effort check and does not guarantee that awaiting the object will succeed,
See also: Python asyncio, coroutine, Future, __await__ protocol, asyncio.isfuture, asyncio.iscoroutine.