def _execute_task(arg, cache, dsk=None):
 if isinstance(arg, list):
  return [_execute_task(a, cache) for a in arg]
 elif istask(arg):
  (func, args) = (arg[0], arg[1:])
  args2 = [_execute_task(a, cache) for a in args]
  return func(*args2)
 elif (not ishashable(arg)):
  return arg
 elif (arg in cache):
  return cache[arg]
 else:
  return arg

def _execute_task ( arg , cache , dsk = None ) : if isinstance ( arg , list ) : return [ _execute_task ( a , cache ) for a in arg ] elif istask ( arg ) : ( func , args ) = ( arg [ 0 ] , arg [ 1 : ] ) args2 = [ _execute_task ( a , cache ) for a in args ] return func ( * args2 ) elif ( not ishashable ( arg ) ) : return arg elif ( arg in cache ) : return cache [ arg ] else : return arg
do the actual work of collecting data and executing a function examples .