import time


def execution_duration(fun):
    """
    Calculates the duration the function 'fun' takes to execute.
    execution_duration returns a wrapper function to which you pass your arguments.

    Example: execution_duration(my_function)(my_first_param, my_second_param)

    The result of the wrapper function will be a tuple, where the fist value is the
    return value of your function and the second is the execution time in seconds expressed
    as a float.
    """
    def wrapper(*args, **kwargs):
        t1 = time.time()
        result = fun(*args, **kwargs)
        exec_dur = time.time() - t1

        return result, exec_dur

    return wrapper