code: def prep_ndarray(values, copy=True):
      if not isinstance(values, (np.ndarray, ABCSeries, Index)):
          if len(values) == 0:
              return np.empty((0, 0), dtype=object)
  
          def convert(v):
              return maybe_convert_platform(v)
  
          # we could have a 1-dim or 2-dim list here
          # this is equiv of np.asarray, but does object conversion
          # and platform dtype preservation
          try:
              if is_list_like(values[0]) or hasattr(values[0], "len"):
                  values = np.array([convert(v) for v in values])
              elif (
                  isinstance(values[0], np.ndarray)
                  and values[0].ndim == 0
              ):
                  # GH#21861
                  values = np.array([convert(v) for v in values])
              else:
                  values = convert(values)
          except (ValueError, TypeError):
              values = convert(values)
  
      else:
          # drop subclass info, do not copy data
          values = np.asarray(values)
          if copy:
              values = values.copy()
  
      if values.ndim == 1:
          values = values.reshape((values.shape[0], 1))
      elif values.ndim != 2:
          raise ValueError("Must pass 2-d input")
  
      return values
  
imports: from collections import OrderedDict
  import numpy
  import numpy.ma
  from pandas._libs import lib
  from pandas._libs.tslibs import IncompatibleFrequency
  import pandas.compat
  from pandas.compat import get_range_parameters, lmap, lrange, raise_with_traceback, range
  from pandas.core.dtypes.cast import construct_1d_arraylike_from_scalar, construct_1d_ndarray_preserving_na, construct_1d_object_array_from_listlike, infer_dtype_from_scalar, maybe_cast_to_datetime, maybe_cast_to_integer_array, maybe_castable, maybe_convert_platform, maybe_infer_to_datetimelike, maybe_upcast
  from pandas.core.dtypes.common import is_categorical_dtype, is_datetime64tz_dtype, is_dtype_equal, is_extension_array_dtype, is_extension_type, is_float_dtype, is_integer_dtype, is_iterator, is_list_like, is_object_dtype, pandas_dtype
  from pandas.core.dtypes.generic import ABCDataFrame, ABCDatetimeIndex, ABCIndexClass, ABCPandasArray, ABCPeriodIndex, ABCSeries, ABCTimedeltaIndex
  from pandas.core.dtypes.missing import isna
  from pandas.core import algorithms, common
  from pandas.core.arrays import Categorical, ExtensionArray, period_array
  from pandas.core.index import Index, _get_objs_combined_axis, _union_indexes, ensure_index
  from pandas.core.indexes import base
  from pandas.core.internals import create_block_manager_from_arrays, create_block_manager_from_blocks
  from pandas.core.internals.arrays import extract_array
label_desc: Use image node_id 5 for calling a global function with example usage: prep_ndarray(values, copy) and returns: values, np, maybe_convert_platform