code: def _get_sudoku_dataset(segment="train"):
      assert segment in ["train", "valid", "test"]
      url = "https://data.dgl.ai/dataset/sudoku-hard.zip"
      zip_fname = "/tmp/sudoku-hard.zip"
      dest_dir = "/tmp/sudoku-hard/"
  
      if not os.path.exists(dest_dir):
          print("Downloading data...")
  
          urllib.request.urlretrieve(url, zip_fname)
          with zipfile.ZipFile(zip_fname) as f:
              f.extractall("/tmp/")
  
      def read_csv(fname):
          print("Reading %s..." % fname)
          with open(dest_dir + fname) as f:
              reader = csv.reader(f, delimiter=",")
              return [(q, a) for q, a in reader]
  
      data = read_csv(segment + ".csv")
  
      def encode(samples):
          def parse(x):
              return list(map(int, list(x)))
  
          encoded = [(parse(q), parse(a)) for q, a in samples]
          return encoded
  
      data = encode(data)
      print(f"Number of puzzles in {segment} set : {len(data)}")
  
      return data
  
file_path: dgl/examples/pytorch/rrn/sudoku_data.py
imports: import csv
  import os
  import urllib.request
  import zipfile
  from copy import copy
  import dgl
  import numpy
  import torch
  from torch.utils.data import DataLoader, RandomSampler, SequentialSampler
  from torch.utils.data.dataset import Dataset
label_desc: Use image node_id 2 for calling a global function with example usage: _get_sudoku_dataset(segment) and returns: data, encoded, unknown, list