code: def cyclic_deps(tree):
      
      key_tree = dict((k.key, v) for k, v in tree.items())
      get_children = lambda n: key_tree.get(n.key, [])
      cyclic = []
      for p, rs in tree.items():
          for req in rs:
              if p.key in map(attrgetter('key'), get_children(req)):
                  cyclic.append((p, req, p))
      return cyclic
docs: Return cyclic dependencies as list of tuples
  
      :param list pkgs: pkg_resources.Distribution instances
      :param dict pkg_index: mapping of pkgs with their respective keys
      :returns: list of tuples representing cyclic dependencies
      :rtype: generator