code: def _walk(self, target, visitor):
      
      visited = set()
  
      def walk(current):
        if current not in visited:
          visited.add(current)
          keep_going = visitor(current)
          if keep_going:
            for dependency in self.dependencies(current):
              walk(dependency)
  
      walk(target)
docs: Walks the dependency graph for the given target.
  
      :param target: The target to start the walk from.
      :param visitor: A function that takes a target and returns `True` if its dependencies should
                      also be visited.