code: def _prepare_edge_arrays(g, arg):
      """Converts the argument into a list of NDArrays.
  
      If the argument is already a list of array-like objects, directly do the
      conversion.
  
      If the argument is a string, converts g.edata[arg] into a list of NDArrays
      ordered by the edge types.
      """
      if isinstance(arg, list) and len(arg) > 0:
          if isinstance(arg[0], nd.NDArray):
              return arg
          else:
              # The list can have None as placeholders for empty arrays with
              # undetermined data type.
              dtype = None
              ctx = None
              result = []
              for entry in arg:
                  if F.is_tensor(entry):
                      result.append(F.to_dgl_nd(entry))
                      dtype = F.dtype(entry)
                      ctx = F.context(entry)
                  else:
                      result.append(None)
  
              result = [
                  F.to_dgl_nd(F.copy_to(F.tensor([], dtype=dtype), ctx))
                  if x is None
                  else x
                  for x in result
              ]
              return result
      elif arg is None:
          return [nd.array([], ctx=nd.cpu())] * len(g.etypes)
      else:
          arrays = []
          for etype in g.canonical_etypes:
              if arg in g.edges[etype].data:
                  arrays.append(F.to_dgl_nd(g.edges[etype].data[arg]))
              else:
                  arrays.append(nd.array([], ctx=nd.cpu()))
          return arrays
  
file_path: dgl/python/dgl/sampling/neighbor.py
imports: import os
  import torch
  from ..None import backend, ndarray, utils
  from .._ffi.function import _init_api
  from ..base import DGLError, EID
  from ..heterograph import DGLBlock, DGLGraph
  from .utils import EidExcluder
label_desc: Use image node_id 1 for calling a global function with example usage: _prepare_edge_arrays(g, arg) and returns: arg, result, unknown, arrays