code: def fetch_cifar10c(
      corruption: Union[str, List[str]],
      severity: int,
      return_X_y: bool = False,
  ) -> Union[Bunch, Tuple[np.ndarray, np.ndarray]]:
      """
      Fetch CIFAR-10-C data. Originally obtained from https://zenodo.org/record/2535967#.XkKh2XX7Qts and
      introduced in "Hendrycks, D and Dietterich, T.G. Benchmarking Neural Network Robustness to Common Corruptions
      and Perturbations. In 7th International Conference on Learning Represenations, 2019.".
  
      Parameters
      ----------
      corruption
          Corruption type. Options can be checked with `get_corruption_cifar10c()`.
          Alternatively, specify 'all' for all corruptions at a severity level.
      severity
          Severity level of corruption (1-5).
      return_X_y
          Bool, whether to only return the data and target values or a Bunch object.
  
      Returns
      -------
      Bunch
          Corrupted dataset with labels.
      (corrupted data, target)
          Tuple if 'return_X_y' equals True.
      """
      url = "https://storage.googleapis.com/seldon-datasets/cifar10c/"
      n = 10000  # instances per corrupted test set
      istart, iend = (
          severity - 1
      ) * n, severity * n  # idx for the relevant severity level
      corruption_list = (
          corruption_types_cifar10c()
      )  # get all possible corruption types
      # convert input to list
      if isinstance(corruption, str) and corruption != "all":
          corruption = [corruption]
      elif corruption == "all":
          corruption = corruption_list
      for corr in corruption:  # check values in corruptions
          if corr not in corruption_list:
              raise ValueError(
                  f"{corr} is not a valid corruption type."
              )
      # get corrupted data
      shape = ((len(corruption)) * n, 32, 32, 3)
      X = np.zeros(shape)
      for i, corr in enumerate(corruption):
          url_corruption = _join_url(url, corr + ".npy")
          try:
              resp = requests.get(url_corruption, timeout=TIMEOUT)
              resp.raise_for_status()
          except RequestException:
              logger.exception(
                  "Could not connect, URL may be out of service"
              )
              raise
          X_corr = np.load(BytesIO(resp.content))[istart:iend].astype(
              "float32"
          )
          X[i * n : (i + 1) * n] = X_corr
  
      # get labels
      url_labels = _join_url(url, "labels.npy")
      try:
          resp = requests.get(url_labels, timeout=TIMEOUT)
          resp.raise_for_status()
      except RequestException:
          logger.exception(
              "Could not connect, URL may be out of service"
          )
          raise
      y = np.load(BytesIO(resp.content))[istart:iend].astype("int64")
      if X.shape[0] != y.shape[0]:
          repeat = X.shape[0] // y.shape[0]
          y = np.tile(y, (repeat,))
  
      if return_X_y:
          return (X, y)
      else:
          return Bunch(data=X, target=y)
  
imports: import io
  import logging
  from io import BytesIO
  from typing import List, Tuple, Type, Union
  from xml.etree import ElementTree
  import dill
  import numpy
  import pandas
  import requests
  from alibi_detect.utils.data import Bunch
  from alibi_detect.utils.url import _join_url
  from requests import RequestException
  from urllib.error import URLError
  from scipy.io import arff
  from sklearn.datasets import fetch_kddcup99
label_desc: Use image node_id 4 for calling a global function with example usage: fetch_cifar10c(corruption, severity, return_X_y) and returns: X,  y, Bunch