code: def _check_hooks_are_valid(result, hook_name):
      if hasattr(result, hook_name):
          _assert_empty_ordered_dict(getattr(result, hook_name))
      if hasattr(result, "parameters"):
          for param in result.parameters():
              _assert_empty_ordered_dict(getattr(param, hook_name))
      if hasattr(result, "modules"):
          for module in result.modules():
              _assert_empty_ordered_dict(getattr(module, hook_name))
  
imports: import builtins
  import collections
  import inspect
  import io
  import logging
  import pickle
  import torch
label_desc: Use image node_id 5 for calling a global function with example usage: _check_hooks_are_valid(result, hook_name) without return types