code: def create_tensorflow_example(
      features: Dict[str, List[Union[int, float, str]]]
  ):
      """Populate a Tensorflow Example with the given features."""
      result = tf.train.Example()
      for name, value in features.items():
          if not value:
              raise ValueError(
                  "each feature must have a populated value list."
              )
          if isinstance(value[0], int):
              result.features.feature[name].int64_list.value.extend(
                  value
              )
          elif isinstance(value[0], float):
              result.features.feature[name].float_list.value.extend(
                  value
              )
          else:
              result.features.feature[name].bytes_list.value.extend(
                  [bytes(v, "utf-8") for v in value]
              )
      return result
  
file_path: tfx/tfx/examples/tfjs_next_page_prediction/bigquery_beam_data_generation.py
imports: from typing import Any, Dict, List, Union
  import apache_beam
  from apache_beam.io.gcp.internal.clients import bigquery
  import tensorflow
label_desc: Use image node_id 2 for calling a global function with example usage: create_tensorflow_example(features) and returns: result