code: def contains_kernel(layer: Layer) -> bool:
      """
      Check whether the layer contains a kernel.
      """
  
      # TODO: add test and check this more throughroughly.
      # rely on Keras convention.
      return (
          hasattr(layer, "kernel")
          or hasattr(layer, "depthwise_kernel")
          or hasattr(layer, "pointwise_kernel")
      )
  
imports: from __future__ import annotations
  import tensorflow.keras.layers
  from tensorflow import Module, keras
  import innvestigate.backend
  from innvestigate.backend.types import Layer, Model
label_desc: Use image node_id 4 for calling a global function with example usage: contains_kernel(layer) and returns: unknown