code: def sort_targets(targets):
    
  
    roots, inverted_deps = invert_dependencies(targets)
    ordered = []
    visited = set()
  
    def topological_sort(target):
      if target not in visited:
        visited.add(target)
        if target in inverted_deps:
          for dep in inverted_deps[target]:
            topological_sort(dep)
        ordered.append(target)
  
    for root in roots:
      topological_sort(root)
  
    return ordered
docs: :API: public
  
    :return: the targets that `targets` depend on sorted from most dependent to least.