from typing import Callable
import asyncio


async def run_sync(function: Callable, *args, **kwargs):
    """
    Async method to run a synchronous function in an executor thread
    """
    return await asyncio.get_running_loop().run_in_executor(
        None, function, *args, **kwargs
    )