code: def test_cull():
      # 'out' depends on 'x' and 'y', but not 'z'
      d = {
          "x": 1,
          "y": (inc, "x"),
          "z": (inc, "x"),
          "out": (add, "y", 10),
      }
      culled, dependencies = cull(d, "out")
      assert culled == {"x": 1, "y": (inc, "x"), "out": (add, "y", 10)}
      assert dependencies == {"x": [], "y": ["x"], "out": ["y"]}
  
      assert cull(d, "out") == cull(d, ["out"])
      assert cull(d, ["out", "z"])[0] == d
      assert cull(d, [["out"], ["z"]]) == cull(d, ["out", "z"])
      pytest.raises(KeyError, lambda: cull(d, "badkey"))
  
imports: import itertools
  import pickle
  from functools import partial
  import pytest
  from flash.core.serve.dag.optimization import SubgraphCallable, cull, functions_of, fuse, fuse_linear, inline, inline_functions
  from flash.core.serve.dag.task import get, get_dependencies
  from flash.core.serve.dag.utils import apply, partial_by_order
  from flash.core.serve.dag.utils_test import add, inc
  from flash.core.utilities.imports import _TOPIC_SERVE_AVAILABLE
label_desc: Use image node_id 2 for calling a global function with example usage: test_cull() without return types