code: def _features_to_schema(
      features: "tf.train.Features",
  ) -> "schema_pb2.Schema":
      from tensorflow_metadata.proto.v0 import schema_pb2
  
      tf_schema = schema_pb2.Schema()
      for feature_name, feature_msg in features.feature.items():
          schema_feature = tf_schema.feature.add()
          schema_feature.name = feature_name
          if feature_msg.HasField("bytes_list"):
              schema_feature.type = schema_pb2.FeatureType.BYTES
          elif feature_msg.HasField("float_list"):
              schema_feature.type = schema_pb2.FeatureType.FLOAT
          elif feature_msg.HasField("int64_list"):
              schema_feature.type = schema_pb2.FeatureType.INT
      return tf_schema
  
imports: import json
  import os
  from typing import TYPE_CHECKING
  import numpy
  import pytest
  from pandas.api.types import is_float_dtype, is_int64_dtype, is_object_dtype
  import ray
  from ray.tests.conftest import *
label_desc: Use image node_id 5 for calling a global function with example usage: _features_to_schema(features) and returns: tf_schema