code: def _check_children_consistency(parent, left, right):
      # Make sure the samples are correctly dispatched from a parent to its
      # children
      assert parent.left_child is left
      assert parent.right_child is right
  
      # each sample from the parent is propagated to one of the two children
      assert len(left.sample_indices) + len(
          right.sample_indices
      ) == len(parent.sample_indices)
  
      assert set(left.sample_indices).union(
          set(right.sample_indices)
      ) == set(parent.sample_indices)
  
      # samples are sent either to the left or the right node, never to both
      assert (
          set(left.sample_indices).intersection(
              set(right.sample_indices)
          )
          == set()
      )
  
imports: import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_equal
  from pytest import approx
  from sklearn.ensemble._hist_gradient_boosting.binning import _BinMapper
  from sklearn.ensemble._hist_gradient_boosting.common import G_H_DTYPE, X_BINNED_DTYPE, X_BITSET_INNER_DTYPE, X_DTYPE, Y_DTYPE
  from sklearn.ensemble._hist_gradient_boosting.grower import TreeGrower
  from sklearn.preprocessing import OneHotEncoder
  from sklearn.utils._openmp_helpers import _openmp_effective_n_threads
label_desc: Use image node_id 2 for calling a global function with example usage: _check_children_consistency(parent, left, right) without return types