code: def resolve_placeholder_expression(
      expression: placeholder_pb2.PlaceholderExpression,
      context: ResolutionContext,
  ) -> PlaceholderResolvedTypeHints:
      """Evaluates a placeholder expression using the given context.
  
      Normally the resolved value will be used as command line flags in strings.
      This function does not automatically perform the string conversion, i.e.,
      the return type is the same as the type of the value originally has. Currently
      it can be
        exec property supported primitive types: int, float, string.
        if use proto operator: serilaized proto message, or proto primitive fields.
      The caller needs to perform desired string conversions.
  
      Args:
        expression: A placeholder expression to be resolved.
        context: Information needed to resolve the expression.
  
      Returns:
        Resolved expression value.
      """
      try:
          result = _ExpressionResolver(context).resolve(expression)
      except NullDereferenceError as err:
          logging.warning(
              "Dereferenced None during placeholder evaluation. Ignoring."
          )
          logging.warning(
              "When evaluating expression=%s, failed to resolve placeholder=%r.",
              debug_str(expression),
              err.placeholder,
          )
          return None
      except Exception as e:
          raise ValueError(
              f"Failed to resolve placeholder expression: {debug_str(expression)}"
          ) from e
  
      if not isinstance(result, _PlaceholderResolvedTypes):
          raise ValueError(
              f"Placeholder {debug_str(expression)} evaluates to "
              f"an unsupported type: {type(result)}."
          )
      return result
  
imports: import base64
  import enum
  import functools
  import os
  import re
  from typing import Any, Callable, Dict, List, Set, Union, cast
  from absl import logging
  import attr
  from tfx.dsl.io import fileio
  from tfx.orchestration.portable import data_types
  from tfx.proto.orchestration import placeholder_pb2
  from tfx.types import artifact
  from tfx.types import artifact_utils
  from tfx.types import value_artifact
  from tfx.utils import json_utils
  from tfx.utils import proto_utils
  from google.protobuf import any_pb2
  from google.protobuf import descriptor
  from google.protobuf import json_format
  from google.protobuf import message
  from google.protobuf import text_format
label_desc: Use image node_id 1 for calling a global function with example usage: resolve_placeholder_expression(expression, context) and returns: result, None