code: def update_schema(
      schema: schema_pb2.Schema,
      statistics: statistics_pb2.DatasetFeatureStatisticsList,
      infer_feature_shape: Optional[bool] = True,
      max_string_domain_size: Optional[int] = 100,
  ) -> schema_pb2.Schema:
      """Updates input schema to conform to the input statistics.
  
      Args:
        schema: A Schema protocol buffer.
        statistics: A DatasetFeatureStatisticsList protocol buffer. Schema inference
          is currently supported only for lists with a single
          DatasetFeatureStatistics proto or lists with multiple
          DatasetFeatureStatistics protos corresponding to data slices that include
          the default slice (i.e., the slice with all examples). If a list with
          multiple DatasetFeatureStatistics protos is used, this function will
          update the schema to conform to the statistics corresponding to the
          default slice.
        infer_feature_shape: DEPRECATED, do not use. If a feature specifies
          a shape, the shape will always be validated. If the feature does not
          specify a shape, this function will not try inferring a shape from the
          given statistics.
        max_string_domain_size: Maximum size of the domain of a string feature in
          order to be interpreted as a categorical feature.
  
      Returns:
        A Schema protocol buffer.
  
      Raises:
        TypeError: If the input argument is not of the expected type.
        ValueError: If the input statistics proto contains multiple datasets, none
            of which corresponds to the default slice.
      """
      del infer_feature_shape
  
      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(
          statistics, statistics_pb2.DatasetFeatureStatisticsList
      ):
          raise TypeError(
              "statistics is of type %s, should be "
              "a DatasetFeatureStatisticsList proto."
              % type(statistics).__name__
          )
  
      # This will raise an exception if there are multiple datasets, none of which
      # corresponds to the default slice.
      dataset_statistics = _get_default_dataset_statistics(statistics)
  
      schema_proto_string = (
          pywrap_tensorflow_data_validation.UpdateSchema(
              tf.compat.as_bytes(schema.SerializeToString()),
              tf.compat.as_bytes(
                  dataset_statistics.SerializeToString()
              ),
              max_string_domain_size,
          )
      )
  
      # Parse the serialized Schema proto.
      result = schema_pb2.Schema()
      result.ParseFromString(schema_proto_string)
  
      return result
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import itertools
  import logging
  from typing import Callable, Iterable, List, Optional, Text, Tuple, Set
  import apache_beam
  import pyarrow
  import tensorflow
  from tensorflow_data_validation import constants
  from tensorflow_data_validation import types
  from tensorflow_data_validation.anomalies.proto import custom_validation_config_pb2
  from tensorflow_data_validation.anomalies.proto import validation_config_pb2
  from tensorflow_data_validation.anomalies.proto import validation_metadata_pb2
  from tensorflow_data_validation.api import validation_options
  from tensorflow_data_validation.pywrap.tensorflow_data_validation_extension import validation
  from tensorflow_data_validation.skew import feature_skew_detector
  from tensorflow_data_validation.skew.protos import feature_skew_results_pb2
  from tensorflow_data_validation.statistics import stats_impl
  from tensorflow_data_validation.statistics import stats_options
  from tensorflow_data_validation.utils import anomalies_util
  from tensorflow_data_validation.utils import slicing_util
  from tensorflow_data_validation.utils import stats_util
  from tensorflow_metadata.proto.v0 import anomalies_pb2
  from tensorflow_metadata.proto.v0 import schema_pb2
  from tensorflow_metadata.proto.v0 import statistics_pb2
label_desc: Use image node_id 3 for calling a global function with example usage: update_schema(schema, statistics, infer_feature_shape, max_string_domain_size) and returns: result