code: def _arrayfy(a):
      from sympy.matrices import MatrixBase
  
      if isinstance(a, NDimArray):
          return a
      if isinstance(a, (MatrixBase, list, tuple, Tuple)):
          return ImmutableDenseNDimArray(a)
      return a
  
imports: import itertools
  from collections.abc import Iterable
  from sympy.core._print_helpers import Printable
  from sympy.core.containers import Tuple
  from sympy.core.function import diff
  from sympy.core.singleton import S
  from sympy.core.sympify import _sympify
  from sympy.tensor.array.ndim_array import NDimArray
  from sympy.tensor.array.dense_ndim_array import DenseNDimArray, ImmutableDenseNDimArray
  from sympy.tensor.array.sparse_ndim_array import SparseNDimArray
label_desc: Use image node_id 1 for calling a global function with example usage: _arrayfy(a) and returns: a, a, ImmutableDenseNDimArray