code: def _encode_multivalent_numeric_feature(
      feature_array: pa.Array, encoding_length: int
  ) -> Optional[List[int]]:
      """Encodes numeric multivalent features into a fixed length representation.
  
      Numeric multivalent features are encoded using bucketization.
      max_encoding_length bins of equal sized intervals are constructed from the
      feature values. For each example, a histogram is constructed. These bin
      counts represent an encoding for the example.
  
      Args:
        feature_array: Arrow Array.
        encoding_length: The length of the list containing the encoded feature
          values.
  
      Returns:
        A list containing the encoded feature values for each example. Returns None
        if unable to encode the feature_array.
      """
      flattened_feature_values = (
          _get_flattened_feature_values_without_nulls(feature_array)
      )
      try:
          _, histogram_bin_boundaries = np.histogram(
              flattened_feature_values, bins=encoding_length - 1
          )
      except IndexError as e:
          # np.histogram cannot handle values > 2**53 if the min and max of the
          # examples are the same. https://github.com/numpy/numpy/issues/8627
          logging.exception(
              "Unable to encode examples: %s with error: %s",
              flattened_feature_values,
              e,
          )
          return None
      return _apply_numerical_encoding_to_feature_array(
          feature_array, histogram_bin_boundaries, encoding_length
      )
  
imports: import collections
  from typing import Any, Dict, Iterable, List, Optional, Set, Tuple
  from absl import logging
  import apache_beam
  import numpy
  import pandas
  import pyarrow
  from tensorflow_data_validation import types
  from tensorflow_data_validation.statistics.generators import partitioned_stats_generator
  from tensorflow_data_validation.utils import feature_partition_util
  from tensorflow_data_validation.utils import mutual_information_util
  from tensorflow_data_validation.utils import schema_util
  from tensorflow_data_validation.utils import stats_util
  from tfx_bsl.arrow import array_util
  from tensorflow_metadata.proto.v0 import schema_pb2
  from tensorflow_metadata.proto.v0 import statistics_pb2
label_desc: Use image node_id 6 for calling a global function with example usage: _encode_multivalent_numeric_feature(feature_array, encoding_length) and returns: _apply_numerical_encoding_to_feature_array, None