code: def getcycle(d, keys):
      """Return a list of nodes that form a cycle if graph is not a DAG. Returns an empty list if no cycle is found.
      ``keys`` may be a single key or list of keys.
  
      Examples
      --------
      >>> from flash.core.serve.dag.utils_test import inc
      >>> d = {'x': (inc, 'z'), 'y': (inc, 'x'), 'z': (inc, 'y')}
      >>> getcycle(d, 'x')
      ['x', 'z', 'y', 'x']
  
      See Also
      --------
      isdag
  
      """
      return _toposort(d, keys=keys, returncycle=True)
  
imports: from collections import defaultdict
  from typing import List, Sequence
  from flash.core.utilities.imports import _TOPIC_SERVE_AVAILABLE
label_desc: Use image node_id 14 for calling a global function with example usage: getcycle(d, keys) and returns: _toposort