code: def get_executions(
      metadata_handle: metadata.Metadata,
      node: node_proto_view.NodeProtoView,
      # TODO(b/258535669) remove want_active and use additional_filters
      want_active: bool = False,
      limit: Optional[int] = None,
      backfill_token: str = "",
      additional_filters: Optional[List[str]] = None,
  ) -> List[metadata_store_pb2.Execution]:
      """Returns all executions for the given pipeline node.
  
      This finds all executions having the same set of contexts as the pipeline
      node.
  
      Args:
        metadata_handle: A handler to access MLMD db.
        node: The pipeline node for which to obtain executions.
        want_active: If set to true, only active executions are returned. Otherwise,
          all executions are returned. Active executions mean executions with NEW or
          RUNNING last_known_state.
        limit: limit the number of executions return by the function. Executions are
          ordered descendingly by CREATE_TIME, so the newest executions will return.
        backfill_token: If non-empty, only executions with custom property
          `__backfill_token__` set to the value are returned. Should only be set
          when backfilling in ASYNC mode.
        additional_filters: Additional filters to select executions.
  
      Returns:
        List of executions ordered descendingly by CREATE_TIME for the given node.
      """
      if not node.contexts.contexts:
          return []
      # Get all the contexts associated with the node.
      filter_query = q.And([])
  
      # "node" context or "pipeline_run" context is a strict sub-context of a
      # "pipeline" context thus we can remove "pipeline" context from the filter
      # query to improve performance.
      filter_contexts = node.contexts.contexts
      context_types = {context.type.name for context in filter_contexts}
  
      if (
          context_constants.PIPELINE_RUN_CONTEXT_TYPE_NAME
          in context_types
          or context_constants.NODE_CONTEXT_TYPE_NAME in context_types
      ):
          context_types.discard(
              context_constants.PIPELINE_CONTEXT_TYPE_NAME
          )
          filter_contexts = [
              q for q in filter_contexts if q.type.name in context_types
          ]
  
      for i, context_spec in enumerate(filter_contexts):
          context_type = context_spec.type.name
          context_name = data_types_utils.get_value(context_spec.name)
          filter_query.append(
              q.And(
                  [
                      f"contexts_{i}.type = '{context_type}'",
                      f"contexts_{i}.name = '{context_name}'",
                  ]
              )
          )
  
      if want_active:
          filter_query.append(
              q.Or(
                  [
                      "last_known_state = NEW",
                      "last_known_state = RUNNING",
                  ]
              )
          )
  
      if backfill_token:
          filter_query.append(
              (
                  "custom_properties.__backfill_token__.string_value ="
                  f" '{backfill_token}'"
              ),
          )
  
      if additional_filters:
          filter_query.extend(additional_filters)
  
      return metadata_handle.store.get_executions(
          list_options=mlmd.ListOptions(
              order_by=mlmd.OrderByField.CREATE_TIME,
              is_asc=False,
              filter_query=str(filter_query),
              limit=limit,
          )
      )
  
imports: import collections
  import itertools
  import json
  import sys
  import textwrap
  from typing import Callable, Dict, Iterable, List, MutableMapping, Optional, Sequence, Type
  import uuid
  from absl import logging
  import attr
  from tfx import types
  from tfx.dsl.compiler import constants
  from tfx.dsl.compiler import placeholder_utils
  from tfx.orchestration import data_types_utils
  from tfx.orchestration import metadata
  from tfx.orchestration import node_proto_view
  from tfx.orchestration.experimental.core import constants
  from tfx.orchestration.experimental.core import mlmd_state
  from tfx.orchestration.experimental.core import task
  from tfx.orchestration import mlmd_connection_manager
  from tfx.orchestration.portable import data_types
  from tfx.orchestration.portable import inputs_utils
  from tfx.orchestration.portable import outputs_utils
  from tfx.orchestration.portable.input_resolution import exceptions
  from tfx.orchestration.portable.mlmd import common_utils
  from tfx.orchestration.portable.mlmd import context_lib
  from tfx.orchestration.portable.mlmd import event_lib
  from tfx.orchestration.portable.mlmd import execution_lib
  from tfx.orchestration.portable.mlmd import filter_query_builder
  from tfx.proto.orchestration import pipeline_pb2
  from tfx.utils import proto_utils
  from tfx.utils import status
  from tfx.utils import typing_utils
  from tfx.orchestration.experimental.core import deployment_config_utils
  import ml_metadata
  from ml_metadata import errors
  from ml_metadata.proto import metadata_store_pb2
label_desc: Use image node_id 7 for calling a global function with example usage: get_executions(metadata_handle, node, want_active, limit, backfill_token, additional_filters) and returns: metadata_handle, list