code: def check_learn_one(model, dataset):
      """learn_one should return the calling model and be pure."""
  
      klass = model.__class__
  
      for x, y in dataset:
          xx, yy = copy.deepcopy(x), copy.deepcopy(y)
  
          if model._supervised:
              model.learn_one(x, y)
          else:
              model.learn_one(x)
  
          # Check the model returns itself
          assert isinstance(model, klass)
  
          # Check learn_one is pure (i.e. x and y haven't changed)
          assert x == xx
          assert y == yy
  
imports: from __future__ import annotations
  import copy
  import inspect
  import pickle
  import random
  from .utils import assert_predictions_are_close, seed_params
label_desc: Use image node_id 1 for calling a global function with example usage: check_learn_one(model, dataset) without return types