code: def _get_feature_value(fpl: query_types.FPL, key: str) -> float:
      """Get value of the given feature from the features dictionary.
  
      The feature must have exactly one value.
  
      Args:
        fpl: FPL
        key: Key of feature to retrieve in features dictionary.
  
      Returns:
        The singular value of the feature.
      """
      feature = fpl["features"].get(key)
      if feature is None:
          raise ValueError(
              "feature %s not found in features %s"
              % (key, fpl["features"])
          )
      if feature.size != 1:
          raise ValueError(
              "feature %s did not contain exactly 1 value. "
              "value was: %s" % (key, feature)
          )
      return feature[0][0]
  
file_path: model-analysis/tensorflow_model_analysis/evaluators/query_metrics/ndcg.py
imports: from typing import Any, Dict, Iterable, List, NamedTuple, Tuple
  import apache_beam
  import numpy
  from tensorflow_model_analysis.evaluators.query_metrics import query_types
  from tensorflow_model_analysis.post_export_metrics import metric_keys
label_desc: Use image node_id 1 for calling a global function with example usage: _get_feature_value(fpl, key) and returns: feature