code: def reorder_list_or_array(M, ordering):
      """Reorders a list or array like object."""
      if isinstance(M, list):
          return [M[i] for i in ordering]
      else:
          return M[ordering]
  
imports: from __future__ import print_function
  from __future__ import division
  import numpy
  from scipy.sparse import dok_matrix
  from scipy.linalg import solve_triangular
label_desc: Use image node_id 20 for calling a global function with example usage: reorder_list_or_array(M, ordering) and returns: unknown, M