code: def _eigh(a, b, dim):
      try:
          return scipy.sparse.linalg.eigsh(a, k=dim, M=b, which="LA")
      except np.linalg.LinAlgError:
          pass  # scipy already tried eigh for us
      except (ValueError, scipy.sparse.linalg.ArpackNoConvergence):
          try:
              return scipy.linalg.eigh(a, b)
          except np.linalg.LinAlgError:
              pass
      return scipy.linalg.eig(a, b)
  
file_path: metric-learn/metric_learn/lfda.py
imports: import numpy
  import scipy
  import warnings
  from sklearn.metrics import pairwise_distances
  from sklearn.base import TransformerMixin
  from ._util import _check_n_components
  from .base_metric import MahalanobisMixin
label_desc: Use image node_id 2 for calling a global function with example usage: _eigh(a, b, dim) and returns: scipy, scipy, scipy