def functions_of(task):
    if istask(task):
        args = set.union(*map(functions_of, task[1:])) if task[1:] else set()
        return set([unwrap_partial(task[0])]) | args
    if isinstance(task, (list, tuple)):
        if not task:
            return set()
        return set.union(*map(functions_of, task))
    return set()
Set of functions contained within nested task
dataset/ETHPy150Open dask/dask/dask/optimize.py/functions_of