code: def _row_to_example(
      instance: Iterable[Tuple[str, str, Any]]
  ) -> tf.train.Example:
      """Convert presto result row to tf example."""
      feature = {}
      for key, data_type, value in instance:
          if value is None:
              feature[key] = tf.train.Feature()
          elif data_type in {
              "tinyint",
              "smallint",
              "integer",
              "bigint",
          }:
              feature[key] = tf.train.Feature(
                  int64_list=tf.train.Int64List(value=[value])
              )
          elif data_type in {"real", "double", "decimal"}:
              feature[key] = tf.train.Feature(
                  float_list=tf.train.FloatList(value=[value])
              )
          elif data_type in {"varchar", "char"}:
              feature[key] = tf.train.Feature(
                  bytes_list=tf.train.BytesList(
                      value=[tf.compat.as_bytes(value)]
                  )
              )
          elif data_type in {"timestamp"}:
              value = int(
                  datetime.datetime.fromisoformat(value).timestamp()
              )
              feature[key] = tf.train.Feature(
                  int64_list=tf.train.Int64List(value=[value])
              )
          else:
              # TODO(b/140266796): support more types
              # https://prestodb.github.io/docs/current/language/types
              raise RuntimeError(
                  "Presto column type {} is not supported.".format(
                      data_type
                  )
              )
      return tf.train.Example(
          features=tf.train.Features(feature=feature)
      )
  
imports: import datetime
  from typing import Any, Dict, Iterable, Tuple
  import apache_beam
  import prestodb
  import tensorflow
  from tfx.components.example_gen import base_example_gen_executor
  from tfx.examples.custom_components.presto_example_gen.proto import presto_config_pb2
  from tfx.proto import example_gen_pb2
  from tfx.utils import proto_utils
label_desc: Use image node_id 3 for calling a global function with example usage: _row_to_example(instance) and returns: tf