diff --git a/Week05/awaitme_berra_soyler.py b/Week05/awaitme_berra_soyler.py new file mode 100644 index 00000000..4a945f1a --- /dev/null +++ b/Week05/awaitme_berra_soyler.py @@ -0,0 +1,14 @@ +import asyncio +from functools import wraps + +def awaitme(func): + @wraps(func) + async def wrapper(*args, **kwargs): + result = func(*args, **kwargs) + + if asyncio.iscoroutine(result): + return await result + else: + return result + + return wrapper