code: def _convert_to_prediction_log(request: iv_types.Request):
      """Try convert infra validation request to TF-Serving PredictionLog."""
      if isinstance(request, classification_pb2.ClassificationRequest):
          return prediction_log_pb2.PredictionLog(
              classify_log=prediction_log_pb2.ClassifyLog(
                  request=request
              )
          )
      elif isinstance(request, regression_pb2.RegressionRequest):
          return prediction_log_pb2.PredictionLog(
              regress_log=prediction_log_pb2.RegressLog(request=request)
          )
      elif isinstance(request, predict_pb2.PredictRequest):
          return prediction_log_pb2.PredictionLog(
              predict_log=prediction_log_pb2.PredictLog(request=request)
          )
      else:
          raise NotImplementedError(
              f"Cannot convert {type(request)} to PredictionLog"
          )
  
imports: import contextlib
  import functools
  import os
  import signal
  import threading
  import time
  from typing import Any, Dict, List, Optional
  from absl import logging
  from tfx import types
  from tfx.components.infra_validator import error_types
  from tfx.components.infra_validator import request_builder
  from tfx.components.infra_validator import serving_bins
  from tfx.components.infra_validator import types
  from tfx.components.infra_validator.model_server_runners import kubernetes_runner
  from tfx.components.infra_validator.model_server_runners import local_docker_runner
  from tfx.dsl.components.base import base_executor
  from tfx.proto import infra_validator_pb2
  from tfx.types import artifact_utils
  from tfx.types import standard_component_specs
  from tfx.utils import io_utils
  from tfx.utils import path_utils
  from tfx.utils import proto_utils
  from tfx.utils.model_paths import tf_serving_flavor
  from tensorflow_serving.apis import classification_pb2
  from tensorflow_serving.apis import predict_pb2
  from tensorflow_serving.apis import prediction_log_pb2
  from tensorflow_serving.apis import regression_pb2
label_desc: Use image node_id 2 for calling a global function with example usage: _convert_to_prediction_log(request) and returns: prediction_log_pb2, prediction_log_pb2, prediction_log_pb2