code: def _eigsorted(cov, asc=True):
      """
      Computes eigenvalues and eigenvectors of a covariance matrix and returns
      them sorted by eigenvalue.
  
      Parameters
      ----------
      cov : ndarray
          covariance matrix
  
      asc : bool, default=True
          determines whether we are sorted smallest to largest (asc=True),
          or largest to smallest (asc=False)
  
      Returns
      -------
      eigval : 1D ndarray
          eigenvalues of covariance ordered largest to smallest
  
      eigvec : 2D ndarray
          eigenvectors of covariance matrix ordered to match `eigval` ordering.
          I.e eigvec[:, 0] is the rotation vector for eigval[0]
      """
  
      eigval, eigvec = np.linalg.eigh(cov)
      order = eigval.argsort()
      if not asc:
          # sort largest to smallest
          order = order[::-1]
  
      return eigval[order], eigvec[:, order]
  
imports: from __future__ import absolute_import, division, unicode_literals
  import math
  from math import cos, sin
  import random
  import warnings
  import numpy
  from numpy.linalg import inv
  import scipy.linalg
  import scipy.sparse
  import scipy.sparse.linalg
  from scipy.stats import norm, multivariate_normal
label_desc: Use image node_id 17 for calling a global function with example usage: _eigsorted(cov, asc) and returns: eigval,  eigvec