code: def _has_capability(est, method: str) -> bool:
      """Check whether estimator has capability of method."""
  
      def get_tag(est, tag_name, tag_value_default=None):
          if isclass(est):
              return est.get_class_tag(
                  tag_name=tag_name, tag_value_default=tag_value_default
              )
          else:
              return est.get_tag(
                  tag_name=tag_name,
                  tag_value_default=tag_value_default,
                  raise_error=False,
              )
  
      if not hasattr(est, method):
          return False
      if method == "inverse_transform":
          return get_tag(est, "capability:inverse_transform", False)
      if method in [
          "predict_proba",
          "predict_interval",
          "predict_quantiles",
          "predict_var",
      ]:
          ALWAYS_HAVE_PREDICT_PROBA = (
              BaseClassifier,
              BaseEarlyClassifier,
              BaseClusterer,
          )
          # all classifiers and clusterers implement predict_proba
          if method == "predict_proba" and isinstance(
              est, ALWAYS_HAVE_PREDICT_PROBA
          ):
              return True
          return get_tag(est, "capability:pred_int", False)
      # skip transform for forecasters that have it - pipelines
      if method == "transform" and scitype(est) in (
          "classifier",
          "forecaster",
      ):
          return False
      if method == "predict" and scitype(est) == "transformer":
          return False
      return True
  
imports: from inspect import isclass, signature
  import numpy
  import pandas
  from pandas.testing import assert_frame_equal
  from sklearn.utils.validation import check_random_state
  from sktime.alignment.base import BaseAligner
  from sktime.base import BaseEstimator, BaseObject
  from sktime.classification.base import BaseClassifier
  from sktime.classification.early_classification import BaseEarlyClassifier
  from sktime.clustering.base import BaseClusterer
  from sktime.datatypes._panel._check import is_nested_dataframe
  from sktime.dists_kernels import BasePairwiseTransformer, BasePairwiseTransformerPanel
  from sktime.forecasting.base import BaseForecaster
  from sktime.registry import scitype
  from sktime.regression.base import BaseRegressor
  from sktime.tests._config import VALID_ESTIMATOR_TYPES
  from sktime.transformations.base import BaseTransformer
label_desc: Use image node_id 9 for calling a global function with example usage: _has_capability(est, method) and returns: True, False, get_tag, get_tag, False, False, est, est, True