code: def _plot_feature_importance(
      exp: Explanation,
      features: List[int],
      targets: List[Union[str, int]],
      summarise: bool = True,
      n_cols: int = 3,
      sort: bool = True,
      top_k: Optional[int] = None,
      plot_limits: Optional[Tuple[float, float]] = None,
      ax: Optional[Union["plt.Axes", np.ndarray]] = None,
      sharey: Optional[Literal["all", "row"]] = "all",
      bar_kw: Optional[dict] = None,
      line_kw: Optional[dict] = None,
      fig_kw: Optional[dict] = None,
  ):
      """
      Feature importance plotting function.
  
      Parameters
      ----------
      exp, features, targets, summarise, n_cols,sort, top_k, plot_limits, ax, sharey, bar_kw, line_kw, fig_kw
          See :py:meth:`alibi.explainers.pd_variance.plot_pd_variance`.
  
      Returns
      -------
      `plt.Axes` with the feature importance plot.
      """
      if summarise:
          # horizontal bar plot for feature importance.
          return _plot_hbar(
              exp_values=exp.data["feature_importance"],
              exp_feature_names=exp.data["feature_names"],
              exp_target_names=exp.meta["params"]["target_names"],
              features=features,
              targets=targets,
              n_cols=n_cols,
              sort=sort,
              top_k=top_k,
              title="Feature importance",
              ax=ax,
              bar_kw=bar_kw,
              fig_kw=fig_kw,
          )
  
      # unpack explanation and redefine targets
      target = targets[0]
  
      feature_names = exp.data["feature_names"]
      feature_values = exp.data["feature_values"]
      feature_deciles = exp.data["feature_deciles"]
      pd_values = exp.data["pd_values"]
  
      target_idx = (
          exp.meta["params"]["target_names"].index(target)
          if isinstance(target, str)
          else target
      )
      feature_importance = exp.data["feature_importance"][target_idx][
          features
      ]
  
      if sort:
          # get sorted indices
          sorted_indices = np.argsort(feature_importance)[::-1]
          features = [features[i] for i in sorted_indices][:top_k]
          feature_importance = feature_importance[sorted_indices][
              :top_k
          ]
  
      # construct pd explanation object to reuse `plot_pd` function
      meta = copy.deepcopy(exp.meta)
      meta["params"]["kind"] = "average"
      data = copy.deepcopy(DEFAULT_DATA_PD)
      data.update(
          feature_names=feature_names,
          feature_values=feature_values,
          pd_values=pd_values,
          feature_deciles=feature_deciles,
      )
      exp_pd = Explanation(meta=meta, data=data)
  
      # plot the partial dependence
      axes = plot_pd(
          exp=exp_pd,
          features=features,
          target=target,
          n_cols=n_cols,
          pd_limits=plot_limits,
          ax=ax,
          sharey=sharey,
          pd_num_kw=line_kw,
          fig_kw=fig_kw,
      )
  
      # add title to each plot with the feature importance
      axes_flatten = axes.flatten()
      for i in range(len(features)):
          ft_name = feature_names[features[i]]
          ft_imp = feature_importance[i]
          axes_flatten[i].set_title(
              "imp({}) = {:.3f}".format(ft_name, ft_imp)
          )
  
      return axes
  
imports: import copy
  import itertools
  import logging
  import math
  import numbers
  import sys
  from enum import Enum
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  import matplotlib.pyplot
  import numpy
  from sklearn.base import BaseEstimator
  from alibi.api.defaults import DEFAULT_DATA_PD, DEFAULT_DATA_PDVARIANCE, DEFAULT_META_PDVARIANCE
  from alibi.api.interfaces import Explainer, Explanation
  from alibi.explainers import plot_pd
  from alibi.explainers.partial_dependence import Kind, PartialDependence, TreePartialDependence
  from alibi.utils import _get_options_string
label_desc: Use image node_id 2 for calling a global function with example usage: _plot_feature_importance(exp, features, targets, summarise, n_cols, sort, top_k, plot_limits, ax, sharey, bar_kw, line_kw, fig_kw) and returns: axes, _plot_hbar