code: def _assert_layer_exists(module, layer_name):
      if layer_name not in dict(module.named_modules()):
          raise ValueError(
              f'Given layer "{layer_name}" does not exist in the model!'
          )
  
imports: import torch
  import torch.nn
  from contextlib import contextmanager
  from small_text.utils.annotations import deprecated
label_desc: Use image node_id 3 for calling a global function with example usage: _assert_layer_exists(module, layer_name) without return types