code: def test_kernel(binary_matrix, result):
      r"""Test that _kernel returns the correct result."""
  
      # get the kernel from the gaussian elimination.
      pivots = (binary_matrix.T != 0).argmax(axis=0)
      nonpivots = np.setdiff1d(range(len(binary_matrix[0])), pivots)
  
      kernel = []
      for col in nonpivots:
          col_vector = binary_matrix[:, col]
          null_vector = np.zeros((binary_matrix.shape[1]), dtype=int)
          null_vector[col] = 1
          for i in pivots:
              first_entry = np.where(binary_matrix[:, i] == 1)[0][0]
              if col_vector[first_entry] == 1:
                  null_vector[i] = 1
          kernel.append(null_vector.tolist())
  
      # get the nullspace from the _kernel function.
      nullspace = _kernel(binary_matrix)
  
      for nullvec in kernel:
          assert nullvec in nullspace.tolist()
  
      assert (nullspace == result).all()
  
imports: import functools
  import pytest
  import scipy
  import pennylane
  from pennylane import numpy
  from pennylane.pauli import pauli_sentence
  from pennylane.qchem.tapering import _kernel, _reduced_row_echelon, clifford, optimal_sector, taper_hf, taper_operation, _split_pauli_sentence, _taper_pauli_sentence
  from pennylane.operation import enable_new_opmath, disable_new_opmath
label_desc: Use image node_id 2 for calling a global function with example usage: test_kernel(binary_matrix, result) without return types