code: def test_multilabel_binarizer_given_classes():
      inp = [(2, 3), (1,), (1, 2)]
      indicator_mat = np.array([[0, 1, 1], [1, 0, 0], [1, 0, 1]])
      # fit_transform()
      mlb = MultiLabelBinarizer(classes=[1, 3, 2])
      assert_array_equal(mlb.fit_transform(inp), indicator_mat)
      assert_array_equal(mlb.classes_, [1, 3, 2])
  
      # fit().transform()
      mlb = MultiLabelBinarizer(classes=[1, 3, 2])
      assert_array_equal(mlb.fit(inp).transform(inp), indicator_mat)
      assert_array_equal(mlb.classes_, [1, 3, 2])
  
      # ensure works with extra class
      mlb = MultiLabelBinarizer(classes=[4, 1, 3, 2])
      assert_array_equal(
          mlb.fit_transform(inp),
          np.hstack(([[0], [0], [0]], indicator_mat)),
      )
      assert_array_equal(mlb.classes_, [4, 1, 3, 2])
  
      # ensure fit is no-op as iterable is not consumed
      inp = iter(inp)
      mlb = MultiLabelBinarizer(classes=[1, 3, 2])
      assert_array_equal(mlb.fit(inp).transform(inp), indicator_mat)
  
      # ensure a ValueError is thrown if given duplicate classes
      err_msg = (
          "The classes argument contains duplicate classes. Remove "
          "these duplicates before passing them to MultiLabelBinarizer."
      )
      mlb = MultiLabelBinarizer(classes=[1, 3, 2, 3])
      with pytest.raises(ValueError, match=err_msg):
          mlb.fit(inp)
  
imports: import numpy
  import pytest
  from scipy.sparse import issparse
  from sklearn import datasets
  from sklearn.preprocessing._label import LabelBinarizer, LabelEncoder, MultiLabelBinarizer, _inverse_binarize_multiclass, _inverse_binarize_thresholding, label_binarize
  from sklearn.utils import _to_object_array
  from sklearn.utils._testing import assert_array_equal, ignore_warnings
  from sklearn.utils.fixes import COO_CONTAINERS, CSC_CONTAINERS, CSR_CONTAINERS, DOK_CONTAINERS, LIL_CONTAINERS
  from sklearn.utils.multiclass import type_of_target
label_desc: Use image node_id 18 for calling a global function with example usage: test_multilabel_binarizer_given_classes() without return types