code: def test_split_label():
      """Test splitting labels."""
      pytest.importorskip("nibabel")
      pytest.importorskip("sklearn")
      aparc = read_labels_from_annot(
          "fsaverage",
          "aparc",
          "lh",
          regexp="lingual",
          subjects_dir=subjects_dir,
      )
      lingual = aparc[0]
  
      # Test input error
      pytest.raises(ValueError, lingual.split, "bad_input_string")
  
      # split with names
      parts = ("lingual_post", "lingual_ant")
      post, ant = split_label(lingual, parts, subjects_dir=subjects_dir)
  
      # check output names
      assert_equal(post.name, parts[0])
      assert_equal(ant.name, parts[1])
  
      # check vertices add up
      lingual_reconst = post + ant
      lingual_reconst.name = lingual.name
      lingual_reconst.comment = lingual.comment
      lingual_reconst.color = lingual.color
      assert_labels_equal(lingual_reconst, lingual)
  
      # compare output of Label.split() method
      post1, ant1 = lingual.split(parts, subjects_dir=subjects_dir)
      assert_labels_equal(post1, post)
      assert_labels_equal(ant1, ant)
  
      # compare fs_like split with freesurfer split
      antmost = split_label(lingual, 40, None, subjects_dir, True)[-1]
      fs_vert = [
          210,
          4401,
          7405,
          12079,
          16276,
          18956,
          26356,
          32713,
          32716,
          32719,
          36047,
          36050,
          42797,
          42798,
          42799,
          59281,
          59282,
          59283,
          71864,
          71865,
          71866,
          71874,
          71883,
          79901,
          79903,
          79910,
          103024,
          107849,
          107850,
          122928,
          139356,
          139357,
          139373,
          139374,
          139375,
          139376,
          139377,
          139378,
          139381,
          149117,
          149118,
          149120,
          149127,
      ]
      assert_array_equal(antmost.vertices, fs_vert)
  
      # check default label name
      assert_equal(antmost.name, "lingual_div40-lh")
  
      # Apply contiguous splitting to DMN label from parcellation in Yeo, 2011
      label_default_mode = read_label(
          subjects_dir / "fsaverage" / "label" / "lh.7Networks_7.label"
      )
      DMN_sublabels = label_default_mode.split(
          parts="contiguous",
          subject="fsaverage",
          subjects_dir=subjects_dir,
      )
      assert_equal(
          [len(label.vertices) for label in DMN_sublabels],
          [16181, 7022, 5965, 5300, 823] + [1] * 23,
      )
  
imports: import glob
  import os
  import pickle
  import shutil
  from itertools import product
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal, assert_array_less, assert_equal
  from scipy import sparse
  from mne import grow_labels, labels_to_stc, morph_labels, random_parcellation, read_label, read_labels_from_annot, read_source_estimate, read_source_spaces, read_surface, spatial_tris_adjacency, split_label, stc_to_label, write_labels_to_annot
  from mne.datasets import testing
  from mne.label import Label, _blend_colors, _load_vert_pos, _n_colors, _read_annot, _read_annot_cands, label_sign_flip, select_sources
  from mne.source_estimate import mesh_edges
  from mne.source_space import SourceSpaces
  from mne.surface import _mesh_borders
  from mne.utils import _record_warnings, get_subjects_dir
label_desc: Use image node_id 16 for calling a global function with example usage: test_split_label() without return types