def function_tree(func, args):
    # map args to function outputs where requested
    for idx, arg in enumerate(args):
        if type(arg) is dict and 'type' in arg and arg['type'] == 'function_output':
            inner_func = import_function(arg['func'])
            args[idx] = function_tree(inner_func, arg['args'])

    # the function is ready to be called
    return call_function(func, args)


# load and build object - universal
dataset/ETHPy150Open qe-team/marmot/marmot/experiment/import_utils.py/function_tree/original