code: def _end_node_is_downstream(
      node: base_node.BaseNode, tfx_pipeline: pipeline.Pipeline
  ) -> bool:
      """Checks if a node needs to declare the eng node as its downstream node."""
      # Given a node N inside a pipeline P, N needs to declare P_end as its
      # downstream node iff N produces at least a same output as P.
      pipeline_outputs_set = {
          c.wrapped for c in tfx_pipeline.outputs.values()
      }
      for node_output in node.outputs.values():
          if node_output in pipeline_outputs_set:
              return True
      return False
  
imports: import itertools
  from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, cast
  from tfx import types
  from tfx.dsl.compiler import compiler_context
  from tfx.dsl.compiler import compiler_utils
  from tfx.dsl.compiler import constants
  from tfx.dsl.compiler import node_inputs_compiler
  from tfx.dsl.components.base import base_component
  from tfx.dsl.components.base import base_driver
  from tfx.dsl.components.base import base_node
  from tfx.dsl.experimental.node_execution_options import utils
  from tfx.dsl.placeholder import placeholder
  from tfx.orchestration import data_types
  from tfx.orchestration import data_types_utils
  from tfx.orchestration import pipeline
  from tfx.proto.orchestration import executable_spec_pb2
  from tfx.proto.orchestration import pipeline_pb2
  from tfx.types import channel
  from tfx.types import channel_utils
  from tfx.utils import deprecation_utils
  from tfx.utils import name_utils
label_desc: Use image node_id 12 for calling a global function with example usage: _end_node_is_downstream(node, tfx_pipeline) and returns: False, True