code: def _init_data(data, allow_empty, default_name):
      """Convert data into canonical form."""
      assert (data is not None) or allow_empty
      if data is None:
          data = []
  
      if isinstance(
          data,
          (np.ndarray, NDArray, h5py.Dataset)
          if h5py
          else (np.ndarray, NDArray),
      ):
          data = [data]
      if isinstance(data, list):
          if not allow_empty:
              assert len(data) > 0
          if len(data) == 1:
              data = OrderedDict(
                  [(default_name, data[0])]
              )  # pylint: disable=redefined-variable-type
          else:
              data = OrderedDict(  # pylint: disable=redefined-variable-type
                  [
                      (f"_{i}_{default_name}", d)
                      for i, d in enumerate(data)
                  ]
              )
      if not isinstance(data, dict):
          raise TypeError(
              "Input must be NDArray, numpy.ndarray, h5py.Dataset "
              + "a list of them or dict with them as values"
          )
      for k, v in data.items():
          if not isinstance(
              v, (NDArray, h5py.Dataset) if h5py else NDArray
          ):
              try:
                  data[k] = array(v)
              except:
                  raise TypeError(
                      (f"Invalid type '{type(v)}' for {k}, ")
                      + "should be NDArray, numpy.ndarray or h5py.Dataset"
                  )
  
      return list(sorted(data.items()))
  
file_path: mxnet/python/mxnet/io/utils.py
imports: from collections import OrderedDict
  import numpy
  from ..ndarray.sparse import CSRNDArray
  from ..ndarray.sparse import array
  from ..ndarray import NDArray
  from ..ndarray import array
label_desc: Use image node_id 1 for calling a global function with example usage: _init_data(data, allow_empty, default_name) and returns: list