code: def load_cats(
      target_size: tuple = (299, 299), return_X_y: bool = False
  ) -> Union[Bunch, Tuple[np.ndarray, np.ndarray]]:
      """
      A small sample of Imagenet-like public domain images of cats used primarily for examples.
      The images were hand-collected using flickr.com by searching for various cat types, filtered by images
      in the public domain.
  
      Parameters
      ----------
      target_size
          Size of the returned images, used to crop images for a specified model input size.
      return_X_y
          If ``True``, return features `X` and labels `y` as `numpy` arrays. If ``False`` return a `Bunch` object
  
      Returns
      -------
      Bunch
          Bunch object with fields 'data', 'target' and 'target_names'. Both `targets` and `target_names` are taken from
          the original Imagenet.
      (data, target)
          Tuple if ``return_X_y=True``.
      """
      tar = tarfile.open(
          fileobj=BytesIO(pkgutil.get_data(__name__, "../data/cats.tar.gz")),  # type: ignore[arg-type]
          mode="r:gz",
      )
      images = []
      target = []
      target_names = []
      for member in tar.getmembers():
          # data
          img = tar.extractfile(member).read()  # type: ignore[union-attr]
          img = PIL.Image.open(BytesIO(img))
          img = np.expand_dims(img.resize(target_size), axis=0)
          images.append(img)
  
          # labels
          name = member.name.split("_")
          target.append(int(name.pop(1)))
          target_names.append("_".join(name).split(".")[0])
      tar.close()
  
      images = np.concatenate(images, axis=0)
      targets = np.asarray(target)
      if return_X_y:
          return images, targets  # type: ignore[return-value] # TODO: allow redefiniton
      else:
          return Bunch(
              data=images, target=targets, target_names=target_names
          )
  
file_path: alibi/alibi/datasets/default.py
imports: import logging
  import pkgutil
  import tarfile
  import json
  from io import BytesIO, StringIO
  from typing import Optional, Tuple, Union, Dict
  import numpy
  import pandas
  import PIL
  import requests
  from requests import RequestException
  from sklearn.preprocessing import LabelEncoder
  from alibi.utils.data import Bunch
label_desc: Use image node_id 2 for calling a global function with example usage: load_cats(target_size, return_X_y) and returns: images,  targets, Bunch