from typing import Callable
from typing import Any
import inspect


async def call_universal(func: Callable, *args: Any, **kwargs: Any) -> Any:
    """Call a function: async or sync one. All passed arguments are passed to the function too

    Args:
        func (Callable): a function to call: either sync or async one

    Returns:
        Any: function execution result
    """
    result = func(*args, **kwargs)
    if inspect.isawaitable(result):
        await result
    return result