code: def prepare_airline(
      dataset_folder, nrows
  ):  # pylint: disable=too-many-locals
      url = "http://kt.ijs.si/elena_ikonomovska/datasets/airline/airline_14col.data.bz2"
      local_url = os.path.join(dataset_folder, os.path.basename(url))
      pickle_url = os.path.join(
          dataset_folder,
          "airline"
          + ("" if nrows is None else "-" + str(nrows))
          + "-pickle.dat",
      )
      if os.path.exists(pickle_url):
          return pickle.load(open(pickle_url, "rb"))
      print("Preparing dataset ...")
      if not os.path.isfile(local_url):
          urlretrieve(url, local_url)
  
      cols = [
          "Year",
          "Month",
          "DayofMonth",
          "DayofWeek",
          "CRSDepTime",
          "CRSArrTime",
          "UniqueCarrier",
          "FlightNum",
          "ActualElapsedTime",
          "Origin",
          "Dest",
          "Distance",
          "Diverted",
          "ArrDelay",
      ]
  
      # load the data as int16
      dtype = np.int16
  
      dtype_columns = {
          "Year": dtype,
          "Month": dtype,
          "DayofMonth": dtype,
          "DayofWeek": dtype,
          "CRSDepTime": dtype,
          "CRSArrTime": dtype,
          "FlightNum": dtype,
          "ActualElapsedTime": dtype,
          "Distance": dtype,
          "Diverted": dtype,
          "ArrDelay": dtype,
      }
  
      df = pd.read_csv(
          local_url, names=cols, dtype=dtype_columns, nrows=nrows
      )
  
      # Encode categoricals as numeric
      for col in df.select_dtypes(["object"]).columns:
          df[col] = df[col].astype("category").cat.codes
  
      # Turn into binary classification problem
      df["ArrDelayBinary"] = 1 * (df["ArrDelay"] > 0)
  
      X = df[df.columns.difference(["ArrDelay", "ArrDelayBinary"])]
      y = df["ArrDelayBinary"]
      del df
      X_train, X_test, y_train, y_test = train_test_split(
          X,
          y,
          random_state=77,
          test_size=0.2,
      )
      data = Data(
          X_train.astype("|f4").to_numpy(),
          X_test.astype("|f4").to_numpy(),
          y_train,
          y_test,
          LearningTask.CLASSIFICATION,
      )
      pickle.dump(data, open(pickle_url, "wb"), protocol=4)
      return data
  
imports: import os
  from enum import Enum
  import pandas
  import pickle
  import numpy
  from sklearn.model_selection import train_test_split
  from sklearn.datasets import load_svmlight_file
  from urllib.request import urlretrieve
label_desc: Use image node_id 2 for calling a global function with example usage: prepare_airline(dataset_folder, nrows) and returns: data, pickle