import time


def time_func(func, kwargs):
    """
    Time a function. Return the time it took to finish and subsequent result.
    """

    start = time.time()
    res = func(**kwargs)
    finish = time.time() - start

    return finish, res