code: def get_bytes_features_categorical_value(
      schema: schema_pb2.Schema,
  ) -> Mapping[
      types.FeaturePath, "schema_pb2.StringDomain.Categorical"
  ]:
      """Get the mapping from FeaturePath to the associated is_categorical value.
  
      The mapping will only perform on features with domain of string_domain or the
      domain is unspecified.
  
      Args:
        schema: The schema for the data.
  
      Returns:
        A dictionary that maps feature to the associated is_categorical value.
      """
      categorical_dict = {}
      feature_domain_mapping = collections.defaultdict(list)
      if schema:
          for feature_path, feature in get_all_leaf_features(schema):
              domain_info = feature.WhichOneof("domain_info")
              if domain_info == "string_domain":
                  categorical_dict[
                      feature_path
                  ] = feature.string_domain.is_categorical
              elif domain_info == "domain":
                  feature_domain_mapping[feature.domain] += [
                      feature_path
                  ]
              elif (
                  domain_info is None
                  and feature.type == schema_pb2.BYTES
              ):
                  categorical_dict[
                      feature_path
                  ] = schema_pb2.StringDomain.CATEGORICAL_UNSPECIFIED
          for domain in schema.string_domain:
              for feature_path in feature_domain_mapping.get(
                  domain.name, []
              ):
                  categorical_dict[feature_path] = domain.is_categorical
      return categorical_dict
  
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 8 for calling a global function with example usage: get_bytes_features_categorical_value(schema) and returns: categorical_dict