code: def get_feature(
      schema: schema_pb2.Schema,
      feature_path: Union[types.FeatureName, types.FeaturePath],
  ) -> schema_pb2.Feature:
      """Get a feature from the schema.
  
      Args:
        schema: A Schema protocol buffer.
        feature_path: The path of the feature to obtain from the schema. If a
          FeatureName is passed, a one-step FeaturePath will be constructed and
          used. For example, "my_feature" -> types.FeaturePath(["my_feature"])
  
      Returns:
        A Feature protocol buffer.
  
      Raises:
        TypeError: If the input schema is not of the expected type.
        ValueError: If the input feature is not found in the schema.
      """
      if not isinstance(schema, schema_pb2.Schema):
          raise TypeError(
              "schema is of type %s, should be a Schema proto."
              % type(schema).__name__
          )
  
      if not isinstance(feature_path, types.FeaturePath):
          feature_path = types.FeaturePath([feature_path])
  
      feature_container = schema.feature
      parent = feature_path.parent()
      if parent:
          for step in parent.steps():
              f = look_up_feature(step, feature_container)
              if f is None:
                  raise ValueError(
                      "Feature %s not found in the schema."
                      % feature_path
                  )
              if f.type != schema_pb2.STRUCT:
                  raise ValueError(
                      "Step %s in feature %s does not refer to a valid STRUCT feature"
                      % (step, feature_path)
                  )
              feature_container = f.struct_domain.feature
  
      feature = look_up_feature(
          feature_path.steps()[-1], feature_container
      )
      if feature is None:
          raise ValueError(
              "Feature %s not found in the schema." % feature_path
          )
      return feature
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  import logging
  from typing import Any, Iterable, List, Mapping, Optional, Set, Text, Tuple, Union
  from tensorflow_data_validation import types
  from tensorflow_data_validation.utils import io_util
  from google.protobuf import descriptor
  from google.protobuf import text_format
  from tensorflow_metadata.proto.v0 import schema_pb2
label_desc: Use image node_id 1 for calling a global function with example usage: get_feature(schema, feature_path) and returns: feature