code: def _add_columns(
      example: tf.train.Example, features: _FeatureListType
  ) -> tf.train.Example:
      """Add given features to `example`."""
      feature_map = example.features.feature
      for col, value in features:
          assert col not in feature_map, (
              "column name %s already exists in example: " "%s"
          ) % (col, example)
          # Note: we only consider three types, bytes, int64 and float for now.
          if isinstance(value[0], (str, bytes)):
              if isinstance(value[0], str):
                  bytes_value = [v.encode("utf-8") for v in value]
              else:
                  bytes_value = value
              feature_map[col].bytes_list.value[:] = bytes_value
          elif isinstance(value[0], int):
              feature_map[col].int64_list.value[:] = value
          else:
              feature_map[col].float_list.value[:] = value
      return example
  
file_path: tfx/tfx/components/bulk_inferrer/prediction_to_example_utils.py
imports: from typing import Any, List, Tuple, Union
  import numpy
  import tensorflow
  from tfx.proto import bulk_inferrer_pb2
  from tensorflow_serving.apis import classification_pb2
  from tensorflow_serving.apis import prediction_log_pb2
label_desc: Use image node_id 6 for calling a global function with example usage: _add_columns(example, features) and returns: example