code: def test_value_if_klass():
      assert _value_if_klass(None, list) is None
      assert _value_if_klass([1], list) == [1]
      with pytest.raises(ValueError):
          _value_if_klass(1, list)
  
imports: import collections
  from xml.etree import ElementTree
  import numpy
  import pytest
  from nibabel import cifti2
  from nibabel.cifti2.cifti2 import Cifti2HeaderError, _float_01, _value_if_klass
  from nibabel.nifti2 import Nifti2Header
  from nibabel.tests.test_dataobj_images import TestDataobjAPI
  from nibabel.tests.test_image_api import DtypeOverrideMixin, SerializeMixin
label_desc: Use image node_id 2 for calling a global function with example usage: test_value_if_klass() without return types