code: def get_minibatch(doc_iter, size, pos_class=positive_class):
      """Extract a minibatch of examples, return a tuple X_text, y.
  
      Note: size is before excluding invalid docs with no topics assigned.
  
      """
      data = [
          (
              "{title}\n\n{body}".format(**doc),
              pos_class in doc["topics"],
          )
          for doc in itertools.islice(doc_iter, size)
          if doc["topics"]
      ]
      if not len(data):
          return np.asarray([], dtype=int), np.asarray([], dtype=int)
      X_text, y = zip(*data)
      return X_text, np.asarray(y, dtype=int)
  
imports: import itertools
  import re
  import sys
  import tarfile
  import time
  from hashlib import sha256
  from html.parser import HTMLParser
  from pathlib import Path
  from urllib.request import urlretrieve
  import matplotlib.pyplot
  import numpy
  from matplotlib import rcParams
  from sklearn.datasets import get_data_home
  from sklearn.feature_extraction.text import HashingVectorizer
  from sklearn.linear_model import PassiveAggressiveClassifier, Perceptron, SGDClassifier
  from sklearn.naive_bayes import MultinomialNB
label_desc: Use image node_id 3 for calling a global function with example usage: get_minibatch(doc_iter, size, pos_class) and returns: X_text,  np, np,  np