code: def minibatcher_default(batch, names):
      """Default minibatcher which maps a list of items to a `MiniBatch` with the
      same names as the items. The names of items are supposed to be provided
      and align with the data attributes of `MiniBatch`. If any unknown item name
      is provided, exception will be raised. If the names of items are not
      provided, the item list is returned as is and a warning will be raised.
  
      Parameters
      ----------
      batch : list
          List of items.
      names : Tuple[str] or None
          Names of items in `batch` with same length. The order should align
          with `batch`.
  
      Returns
      -------
      MiniBatch
          A minibatch.
      """
      if names is None:
          dgl_warning(
              "Failed to map item list to `MiniBatch` as the names of items are "
              "not provided. Please provide a customized `MiniBatcher`. "
              "The item list is returned as is."
          )
          return batch
      if len(names) == 1:
          # Handle the case of single item: batch = tensor([0, 1, 2, 3]), names =
          # ("seed_nodes",) as `zip(batch, names)` will iterate over the tensor
          # instead of the batch.
          init_data = {names[0]: batch}
      else:
          if isinstance(batch, Mapping):
              init_data = {
                  name: {k: v[i] for k, v in batch.items()}
                  for i, name in enumerate(names)
              }
          else:
              init_data = {
                  name: item for item, name in zip(batch, names)
              }
      minibatch = MiniBatch()
      for name, item in init_data.items():
          if not hasattr(minibatch, name):
              dgl_warning(
                  f"Unknown item name '{name}' is detected and added into "
                  "`MiniBatch`. You probably need to provide a customized "
                  "`MiniBatcher`."
              )
          if name == "node_pairs":
              # `node_pairs` is passed as a tensor in shape of `(N, 2)` and
              # should be converted to a tuple of `(src, dst)`.
              if isinstance(item, Mapping):
                  item = {
                      key: (item[key][:, 0], item[key][:, 1])
                      for key in item
                  }
              else:
                  item = (item[:, 0], item[:, 1])
          setattr(minibatch, name, item)
      return minibatch
  
imports: from collections.abc import Mapping
  from functools import partial
  from typing import Callable, Iterator, Optional, Union
  import numpy
  import torch
  import torch.distributed
  from torch.utils.data import default_collate
  from torchdata.datapipes.iter import IterableWrapper, IterDataPipe
  from ..base import dgl_warning
  from ..batch import batch
  from ..heterograph import DGLGraph
  from .internal import calculate_range
  from .itemset import ItemSet, ItemSetDict
  from .minibatch import MiniBatch
label_desc: Use image node_id 1 for calling a global function with example usage: minibatcher_default(batch, names) and returns: minibatch, batch