code: def normalize_spec(value: t.Any) -> "tf_ext.TypeSpec":
      """normalize tensor spec"""
      if not check_tensor_spec(value, TENSOR_CLASS_NAMES):
          return value
      if check_tensor_spec(value, "RaggedTensor"):
          return tf.RaggedTensorSpec.from_value(value)
      if check_tensor_spec(value, "SparseTensor"):
          return tf.SparseTensorSpec.from_value(value)
      if check_tensor_spec(value, "TensorArray"):
          return tf.TensorArraySpec.from_value(value)
      if check_tensor_spec(value, ("Tensor", "EagerTensor")):
          return tf.TensorSpec.from_tensor(value)
      raise BentoMLException(
          f"Unknown type for tensor spec, got{type(value)}."
      )
  
imports: from __future__ import annotations
  import importlib.metadata
  import importlib.util
  import logging
  import typing
  from typing import TYPE_CHECKING
  from bentoml.exceptions import BentoMLException
  from ...types import LazyType
  from ...utils.lazy_loader import LazyLoader
label_desc: Use image node_id 5 for calling a global function with example usage: normalize_spec(value) and returns: value, tf, tf, tf, tf