code: def is_categorical_feature(feature: schema_pb2.Feature):
      """Checks if the input feature is categorical."""
      if feature.type == schema_pb2.BYTES:
          return True
      elif feature.type == schema_pb2.INT:
          return (
              feature.HasField("int_domain")
              and feature.int_domain.is_categorical
          ) or feature.WhichOneof("domain_info") in [
              "bool_domain",
              "natural_language_domain",
          ]
      elif feature.type == schema_pb2.FLOAT:
          return (
              feature.HasField("float_domain")
              and feature.float_domain.is_categorical
          )
      else:
          return False
  
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 7 for calling a global function with example usage: is_categorical_feature(feature) and returns: True, unknown, unknown, False