import time


def time_function(func, dat):
    """
    Run a function and return its processing time.
    
    Arguments:
        func: The function to run.
        dat: An argument to pass to func.
        
    Returns: The processing time [s].
    """
    
    start = time.perf_counter()
    ret = func(dat)
    end = time.perf_counter()
    return ret, end-start