def METHOD_NAME(
    function: AsyncFunc,
    lock: Optional[AsyncLock] = None
) -> AsyncFunc:
    """Wrap an async function with an async lock."""
    @wraps(function)
    async def wrapped(*args, **kwargs):
        nonlocal lock
        if lock is None:
            lock = lock or cast(AsyncLock, asyncio.Lock())
        async with lock:
            return await function(*args, **kwargs)
    return wrapped