code: def arr_to_2d(arr, oned_as="row"):
      """Make ``arr`` exactly two dimensional
  
      If `arr` has more than 2 dimensions, raise a ValueError
  
      Parameters
      ----------
      arr : array
      oned_as : {'row', 'column'}, optional
         Whether to reshape 1-D vectors as row vectors or column vectors.
         See documentation for ``matdims`` for more detail
  
      Returns
      -------
      arr2d : array
         2-D version of the array
      """
      dims = matdims(arr, oned_as)
      if len(dims) > 2:
          raise ValueError(
              "Matlab 4 files cannot save arrays with more than "
              "2 dimensions"
          )
      return arr.reshape(dims)
  
imports: import sys
  import warnings
  import numpy
  import scipy.sparse
  from .miobase import MatFileReader, docfiller, matdims, read_dtype, convert_dtypes, arr_to_chars, arr_dtype_number
  from .mio_utils import squeeze_element, chars_to_strings
  from functools import reduce
label_desc: Use image node_id 1 for calling a global function with example usage: arr_to_2d(arr, oned_as) and returns: arr