code: def vtkmatrix_from_array(array):
      """Convert a ``numpy.ndarray`` or array-like to a vtk matrix.
  
      Parameters
      ----------
      array : array_like[float]
          The array or array-like to be converted to a vtk matrix.
          Shape (3, 3) gets converted to a ``vtk.vtkMatrix3x3``, shape (4, 4)
          gets converted to a ``vtk.vtkMatrix4x4``. No other shapes are valid.
  
      Returns
      -------
      vtk.vtkMatrix3x3 or vtk.vtkMatrix4x4
          VTK matrix.
  
      """
      array = np.asarray(array)
      if array.shape == (3, 3):
          matrix = _vtk.vtkMatrix3x3()
      elif array.shape == (4, 4):
          matrix = _vtk.vtkMatrix4x4()
      else:
          raise ValueError(
              f"Invalid shape {array.shape}, must be (3, 3) or (4, 4)."
          )
      m, n = array.shape
      for i, j in product(range(m), range(n)):
          matrix.SetElement(i, j, array[i, j])
      return matrix
  
imports: import collections.abc
  import enum
  from itertools import product
  from typing import Optional, Tuple, Union
  import numpy
  import pyvista
  from pyvista.core import _vtk_core
  from pyvista.core._typing_core import Matrix, NumpyArray, TransformLike, Vector
  from pyvista.core.errors import AmbiguousDataError, MissingDataError
label_desc: Use image node_id 20 for calling a global function with example usage: vtkmatrix_from_array(array) and returns: matrix