code: def _list_model_options(
      indent, config_to_class=None, use_model_types=True
  ):
      if config_to_class is None and not use_model_types:
          raise ValueError(
              "Using `use_model_types=False` requires a `config_to_class` dictionary."
          )
      if use_model_types:
          if config_to_class is None:
              model_type_to_name = {
                  model_type: f":class:`~fastNLP.transformers.torch.{config}`"
                  for model_type, config in CONFIG_MAPPING_NAMES.items()
              }
          else:
              model_type_to_name = {
                  model_type: _get_class_name(model_class)
                  for model_type, model_class in config_to_class.items()
                  if model_type in MODEL_NAMES_MAPPING
              }
          lines = [
              f"{indent}- **{model_type}** -- {model_type_to_name[model_type]} ({MODEL_NAMES_MAPPING[model_type]} model)"
              for model_type in sorted(model_type_to_name.keys())
          ]
      else:
          config_to_name = {
              CONFIG_MAPPING_NAMES[config]: _get_class_name(clas)
              for config, clas in config_to_class.items()
              if config in CONFIG_MAPPING_NAMES
          }
          config_to_model_name = {
              config: MODEL_NAMES_MAPPING[model_type]
              for model_type, config in CONFIG_MAPPING_NAMES.items()
          }
          lines = [
              f"{indent}- :class:`~fastNLP.transformers.torch.{config_name}` configuration class: {config_to_name[config_name]} ({config_to_model_name[config_name]} model)"
              for config_name in sorted(config_to_name.keys())
          ]
      return "\n".join(lines)
  
imports: import importlib
  import re
  from collections import OrderedDict
  from typing import List, Union
  from fastNLP.transformers.torch.configuration_utils import PretrainedConfig
  from fastNLP.transformers.torch.file_utils import CONFIG_NAME
  from fastNLP.core.log import logger
label_desc: Use image node_id 4 for calling a global function with example usage: _list_model_options(indent, config_to_class, use_model_types) and returns: str