from typing import Callable
from typing import Any
from typing import Awaitable
import functools
import asyncio


def run_in_executor(blocking_fn: Callable[..., Any]) -> Callable[..., Awaitable[Any]]:
    """Decorator for executing blocking code asynchronously.

    Args:
        blocking_fn (Callable[..., Any]): A blocking function or method.

    Returns:
        Callable[..., Awaitable[Any]]: An awaitable object.
    """

    @functools.wraps(blocking_fn)
    async def inner(*args: Any, **kwargs: Any):
        loop = asyncio.get_running_loop()
        return await loop.run_in_executor(None, lambda: blocking_fn(*args, **kwargs))

    return inner