code: def unpack_data(data):
      
      # Note: This function cannot detect it when a user only returns 1
      # item that is exactly of length 2 (e.g. because the batch size is
      # 2). In that case, the item will be erroneously split into X and
      # y.
      try:
          X, y = data
          return X, y
      except ValueError:
          # if a 1-tuple/list or something else like a torch tensor
          if not isinstance(data, (tuple, list)) or len(data) < 2:
              raise ValueError(ERROR_MSG_1_ITEM)
          raise ValueError(ERROR_MSG_MORE_THAN_2_ITEMS.format(len(data)))
docs: Unpack data returned by the net's iterator into a 2-tuple.
  
      If the wrong number of items is returned, raise a helpful error
      message.