code: def _set_feature_value(
      features: types.DictOfFetchedTensorValues,
      feature_key: str,
      feature_value: Any,
  ) -> types.DictOfFetchedTensorValues:
      """Helper to set feature in FPL dict."""
      if not isinstance(feature_value, np.ndarray) and not isinstance(
          feature_value, tf.compat.v1.SparseTensorValue
      ):
          feature_value = np.array([feature_value])
      features[feature_key] = {encoding.NODE_SUFFIX: feature_value}
      return features
  
file_path: model-analysis/tensorflow_model_analysis/extractors/legacy_meta_feature_extractor.py
imports: import copy
  from typing import Any, Callable
  import apache_beam
  import numpy
  import tensorflow
  from tensorflow_model_analysis import constants
  from tensorflow_model_analysis.api import types
  from tensorflow_model_analysis.eval_saved_model import encoding
label_desc: Use image node_id 2 for calling a global function with example usage: _set_feature_value(features, feature_key, feature_value) and returns: features