code: def _execute_task(arg, cache, dsk=None):
      """Do the actual work of collecting data and executing a function
  
      Examples
      --------
  
      >>> inc = lambda x: x + 1
      >>> add = lambda x, y: x + y
      >>> cache = {'x': 1, 'y': 2}
  
      Compute tasks against a cache
      >>> _execute_task((add, 'x', 1), cache)  # Compute task in naive manner
      2
      >>> _execute_task((add, (inc, 'x'), 1), cache)  # Support nested computation
      3
  
      Also grab data from cache
      >>> _execute_task('x', cache)
      1
  
      Support nested lists
      >>> list(_execute_task(['x', 'y'], cache))
      [1, 2]
  
      >>> list(map(list, _execute_task([['x', 'y'], ['y', 'x']], cache)))
      [[1, 2], [2, 1]]
  
      >>> _execute_task('foo', cache)  # Passes through on non-keys
      'foo'
      """
      if isinstance(arg, list):
          return [_execute_task(a, cache) for a in arg]
      elif istask(arg):
          func, args = arg[0], arg[1:]
          # Note: Don't assign the subtask results to a variable. numpy detects
          # temporaries by their reference count and can execute certain
          # operations in-place.
          return func(*(_execute_task(a, cache) for a in args))
      elif not ishashable(arg):
          return arg
      elif arg in cache:
          return cache[arg]
      else:
          return arg
  
imports: from __future__ import annotations
  from collections import defaultdict
  from collections.abc import Collection, Iterable, Mapping
  from typing import Any, Literal, TypeVar, cast, overload
  from dask.typing import Graph, Key, NoDefault, no_default
label_desc: Use image node_id 6 for calling a global function with example usage: _execute_task(arg, cache, dsk) and returns: unknown, func, arg, cache, arg