code: def _replicate_schema_for_sliced_validation(
      schema: schema_pb2.Schema, slice_names: Set[str]
  ) -> schema_pb2.Schema:
      """Replicates features in a schema with prepended slice names."""
      if schema.HasField("dataset_constraints") is not None:
          logging.error(
              "DatasetConstraints will not be validated per-slice."
          )
      result = schema_pb2.Schema()
      result.string_domain.extend(schema.string_domain)
      result.float_domain.extend(schema.float_domain)
      result.int_domain.extend(schema.int_domain)
      for slice_name in slice_names:
          for feature in schema.feature:
              new_feature = result.feature.add()
              new_feature.CopyFrom(feature)
              new_feature.name = _prepend_slice_name(
                  slice_name, feature.name
              )
          for sparse_feature in schema.sparse_feature:
              new_sparse_feature = result.sparse_feature.add()
              new_sparse_feature.CopyFrom(sparse_feature)
              new_sparse_feature.name = _prepend_slice_name(
                  slice_name, sparse_feature.name
              )
          for weighted_feature in schema.weighted_feature:
              new_weighted_feature = result.weighted_feature.add()
              new_weighted_feature.CopyFrom(weighted_feature)
              new_weighted_feature.name = _prepend_slice_name(
                  slice_name, weighted_feature.name
              )
      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 16 for calling a global function with example usage: _replicate_schema_for_sliced_validation(schema, slice_names) and returns: result