code: def _generate_input_spec_for_outputs(
      node: pipeline_pb2.PipelineNode,
      tfx_node_outputs: Dict[str, types.Channel],
      negative_context_filter: Callable[
          [pipeline_pb2.ContextSpec], bool
      ] = lambda _: False,
  ) -> Iterator[Tuple[types.Channel, pipeline_pb2.InputSpec.Channel]]:
      """Generates InputSpec in producer node, to be used by consumer node later."""
      for key, value in tfx_node_outputs.items():
          channel_pb = pipeline_pb2.InputSpec.Channel()
          channel_pb.producer_node_query.id = node.node_info.id
          for context in node.contexts.contexts:
              if negative_context_filter(context):
                  continue
              context_query = channel_pb.context_queries.add()
              context_query.type.CopyFrom(context.type)
              context_query.name.CopyFrom(context.name)
  
          artifact_type = (
              value.type._get_artifact_type()
          )  # pylint: disable=protected-access
          channel_pb.artifact_query.type.CopyFrom(artifact_type)
          channel_pb.artifact_query.type.ClearField("properties")
          channel_pb.output_key = key
          yield value, channel_pb
  
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 5 for calling a global function with example usage: _generate_input_spec_for_outputs(node, tfx_node_outputs, negative_context_filter) without return types