code: def chebyshev_polynomial(X, k):
      """
      Calculates Chebyshev polynomials of X, up to order k.
      :param X: rank 2 array or sparse matrix;
      :param k: the order up to which compute the polynomials,
      :return: a list of k + 1 arrays or sparse matrices with one element for each
      degree of the polynomial.
      """
      T_k = list()
      if sp.issparse(X):
          T_k.append(sp.eye(X.shape[0], dtype=X.dtype).tocsr())
      else:
          T_k.append(np.eye(X.shape[0], dtype=X.dtype))
      T_k.append(X)
  
      def chebyshev_recurrence(T_k_minus_one, T_k_minus_two, X):
          if sp.issparse(X):
              X_ = sp.csr_matrix(X, copy=True)
          else:
              X_ = np.copy(X)
          return 2 * X_.dot(T_k_minus_one) - T_k_minus_two
  
      for _ in range(2, k + 1):
          T_k.append(chebyshev_recurrence(T_k[-1], T_k[-2], X))
  
      return T_k
  
imports: import copy
  import warnings
  from functools import partial
  import numpy
  import tensorflow
  from scipy import linalg
  from scipy import sparse
  from scipy.sparse.linalg import ArpackNoConvergence
label_desc: Use image node_id 12 for calling a global function with example usage: chebyshev_polynomial(X, k) and returns: T_k, unknown