code: def list_models(
      module: Optional[ModuleType] = None,
      include: Union[Iterable[str], str, None] = None,
      exclude: Union[Iterable[str], str, None] = None,
  ) -> List[str]:
      """
      Returns a list with the names of registered models.
  
      Args:
          module (ModuleType, optional): The module from which we want to extract the available models.
          include (str or Iterable[str], optional): Filter(s) for including the models from the set of all models.
              Filters are passed to `fnmatch <https://docs.python.org/3/library/fnmatch.html>`__ to match Unix shell-style
              wildcards. In case of many filters, the results is the union of individual filters.
          exclude (str or Iterable[str], optional): Filter(s) applied after include_filters to remove models.
              Filter are passed to `fnmatch <https://docs.python.org/3/library/fnmatch.html>`__ to match Unix shell-style
              wildcards. In case of many filters, the results is removal of all the models that match any individual filter.
  
      Returns:
          models (list): A list with the names of available models.
      """
      all_models = {
          k
          for k, v in BUILTIN_MODELS.items()
          if module is None
          or v.__module__.rsplit(".", 1)[0] == module.__name__
      }
      if include:
          models: Set[str] = set()
          if isinstance(include, str):
              include = [include]
          for include_filter in include:
              models = models | set(
                  fnmatch.filter(all_models, include_filter)
              )
      else:
          models = all_models
  
      if exclude:
          if isinstance(exclude, str):
              exclude = [exclude]
          for exclude_filter in exclude:
              models = models - set(
                  fnmatch.filter(all_models, exclude_filter)
              )
      return sorted(models)
  
imports: import fnmatch
  import importlib
  import inspect
  import sys
  from dataclasses import dataclass
  from enum import Enum
  from functools import partial
  from inspect import signature
  from types import ModuleType
  from typing import Any, Callable, Dict, Iterable, List, Mapping, Optional, Set, Type, TypeVar, Union
  from torch import nn
  from .._internally_replaced_utils import load_state_dict_from_url
label_desc: Use image node_id 5 for calling a global function with example usage: list_models(module, include, exclude) and returns: sorted