code: def eligible_modules(
      model,
      whitelist_layer_types,
      allowed_layer_names,
      disallowed_layer_names,
  ):
      eligible_modules_list = []
      for name, mod in model.named_modules():
          if (
              isinstance(mod, whitelist_layer_types)
              and name not in disallowed_layer_names
          ):
              if (
                  allowed_layer_names is not None
                  and name not in allowed_layer_names
              ):
                  continue
              eligible_modules_list.append((name, mod))
      return eligible_modules_list
  
file_path: apex/apex/contrib/sparsity/asp.py
imports: import types
  import torch
  from .sparse_masklib import create_mask
  from .permutation_lib import Permutation
  import json
  import os
  import string
  import time
label_desc: Use image node_id 1 for calling a global function with example usage: eligible_modules(model, whitelist_layer_types, allowed_layer_names, disallowed_layer_names) and returns: eligible_modules_list