code: def _orthogonalize(cls, *vecs, normalize=False, rankcheck=False):
      """Apply the Gram-Schmidt orthogonalization procedure
      to vectors supplied in ``vecs``.
  
      Parameters
      ==========
  
      vecs
          vectors to be made orthogonal
  
      normalize : bool
          If ``True``, return an orthonormal basis.
  
      rankcheck : bool
          If ``True``, the computation does not stop when encountering
          linearly dependent vectors.
  
          If ``False``, it will raise ``ValueError`` when any zero
          or linearly dependent vectors are found.
  
      Returns
      =======
  
      list
          List of orthogonal (or orthonormal) basis vectors.
  
      Examples
      ========
  
      >>> from sympy import I, Matrix
      >>> v = [Matrix([1, I]), Matrix([1, -I])]
      >>> Matrix.orthogonalize(*v)
      [Matrix([
      [1],
      [I]]), Matrix([
      [ 1],
      [-I]])]
  
      See Also
      ========
  
      MatrixBase.QRdecomposition
  
      References
      ==========
  
      .. [1] https://en.wikipedia.org/wiki/Gram%E2%80%93Schmidt_process
      """
      from .decompositions import _QRdecomposition_optional
  
      if not vecs:
          return []
  
      all_row_vecs = vecs[0].rows == 1
  
      vecs = [x.vec() for x in vecs]
      M = cls.hstack(*vecs)
      Q, R = _QRdecomposition_optional(M, normalize=normalize)
  
      if rankcheck and Q.cols < len(vecs):
          raise ValueError(
              "GramSchmidt: vector set not linearly independent"
          )
  
      ret = []
      for i in range(Q.cols):
          if all_row_vecs:
              col = cls(Q[:, i].T)
          else:
              col = cls(Q[:, i])
          ret.append(col)
      return ret
  
imports: from .utilities import _iszero
label_desc: Use image node_id 4 for calling a global function with example usage: _orthogonalize(cls) and returns: ret, list