code: def serialize_mlmd_connection_config(
      connection_config: metadata.ConnectionConfigType,
  ) -> str:
      """Serializes an MLMD connection config into a base64 flag of its wrapper."""
      mlmd_wrapper = metadata_pb2.MLMDConnectionConfig()
      for (
          name,
          descriptor,
      ) in (
          metadata_pb2.MLMDConnectionConfig.DESCRIPTOR.fields_by_name.items()
      ):
          if (
              descriptor.message_type.full_name
              == connection_config.DESCRIPTOR.full_name
          ):
              getattr(mlmd_wrapper, name).CopyFrom(connection_config)
              break
      return base64.b64encode(mlmd_wrapper.SerializeToString()).decode(
          "ascii"
      )
  
file_path: tfx/tfx/orchestration/python_execution_binary/python_execution_binary_utils.py
imports: import base64
  from typing import Union
  from tfx.orchestration import metadata
  from tfx.orchestration.portable import data_types
  from tfx.proto.orchestration import executable_spec_pb2
  from tfx.proto.orchestration import execution_invocation_pb2
  from tfx.proto.orchestration import metadata_pb2
label_desc: Use image node_id 4 for calling a global function with example usage: serialize_mlmd_connection_config(connection_config) and returns: base64