code: def get_dependencies(
      dsk: Graph,
      key: Key | None = None,
      task: Key | NoDefault = no_default,
      as_list: bool = False,
  ) -> set[Key] | list[Key]:
      """Get the immediate tasks on which this task depends
  
      Examples
      --------
      >>> inc = lambda x: x + 1
      >>> add = lambda x, y: x + y
      >>> dsk = {'x': 1,
      ...        'y': (inc, 'x'),
      ...        'z': (add, 'x', 'y'),
      ...        'w': (inc, 'z'),
      ...        'a': (add, (inc, 'x'), 1)}
  
      >>> get_dependencies(dsk, 'x')
      set()
  
      >>> get_dependencies(dsk, 'y')
      {'x'}
  
      >>> get_dependencies(dsk, 'z')  # doctest: +SKIP
      {'x', 'y'}
  
      >>> get_dependencies(dsk, 'w')  # Only direct dependencies
      {'z'}
  
      >>> get_dependencies(dsk, 'a')  # Ignore non-keys
      {'x'}
  
      >>> get_dependencies(dsk, task=(inc, 'x'))  # provide tasks directly
      {'x'}
      """
      if key is not None:
          arg = dsk[key]
      elif task is not no_default:
          arg = task
      else:
          raise ValueError("Provide either key or task")
  
      return keys_in_tasks(dsk, [arg], as_list=as_list)
  
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 13 for calling a global function with example usage: get_dependencies(dsk, key, task, as_list) and returns: keys_in_tasks