code: def _build_executable_spec(
      node_id: str, spec: any_pb2.Any
  ) -> local_deployment_config_pb2.ExecutableSpec:
      """Builds ExecutableSpec given the any proto from IntermediateDeploymentConfig."""
      result = local_deployment_config_pb2.ExecutableSpec()
      if spec.Is(result.python_class_executable_spec.DESCRIPTOR):
          spec.Unpack(result.python_class_executable_spec)
      elif spec.Is(result.container_executable_spec.DESCRIPTOR):
          spec.Unpack(result.container_executable_spec)
      elif spec.Is(result.beam_executable_spec.DESCRIPTOR):
          spec.Unpack(result.beam_executable_spec)
      else:
          raise ValueError(
              "Executor spec of {} is expected to be of one of the "
              "types of tfx.orchestration.deployment_config.ExecutableSpec.spec "
              "but got type {}".format(node_id, spec.type_url)
          )
      return result
  
file_path: tfx/tfx/orchestration/local/runner_utils.py
imports: from typing import Optional
  from absl import logging
  from tfx.proto.orchestration import local_deployment_config_pb2
  from tfx.proto.orchestration import metadata_pb2
  from tfx.proto.orchestration import pipeline_pb2
  from google.protobuf import any_pb2
  from google.protobuf import message
label_desc: Use image node_id 2 for calling a global function with example usage: _build_executable_spec(node_id, spec) and returns: result