class_docstr: Any class that inherits from `Registrable` gains access to a named registry for its
  subclasses. To register them, just decorate them with the classmethod
  `@BaseClass.register(name)`.
  
  After which you can call `BaseClass.list_available()` to get the keys for the
  registered subclasses, and `BaseClass.by_name(name)` to get the corresponding subclass.
  Note that the registry stores the subclasses themselves; not class instances.
  In most cases you would then call `from_params(params)` on the returned subclass.
  
  You can specify a default by setting `BaseClass.default_implementation`.
  If it is set, it will be the first element of `list_available()`.
  
  Note that if you use this class to implement a new `Registrable` abstract class,
  you must ensure that all subclasses of the abstract class are loaded when the module is
  loaded, because the subclasses register themselves in their respective files. You can
  achieve this by having the abstract class and all subclasses in the __init__.py of the
  module in which they reside (as this causes any import of either the abstract class or
  a subclass to load all other subclasses and the abstract class).
class_docstr_tok: ["Any","class","that","inherits","from","`","Registrable","`","gains","access","to","a","named","registry","for","its","subclasses",".","To","register","them",",","just","decorate","them","with","the","classmethod","`","@","BaseClass.register","(","name",")","`",".","After","which","you","can","call","`","BaseClass.list_available","(",")","`","to","get","the","keys","for","the","registered","subclasses",",","and","`","BaseClass.by_name","(","name",")","`","to","get","the","corresponding","subclass",".","Note","that","the","registry","stores","the","subclasses","themselves",";","not","class","instances",".","In","most","cases","you","would","then","call","`","from_params","(","params",")","`","on","the","returned","subclass",".","You","can","specify","a","default","by","setting","`","BaseClass.default_implementation","`",".","If","it","is","set",",","it","will","be","the","first","element","of","`","list_available","(",")","`",".","Note","that","if","you","use","this","class","to","implement","a","new","`","Registrable","`","abstract","class",",","you","must","ensure","that","all","subclasses","of","the","abstract","class","are","loaded","when","the","module","is","loaded",",","because","the","subclasses","register","themselves","in","their","respective","files",".","You","can","achieve","this","by","having","the","abstract","class","and","all","subclasses","in","the","__init__.py","of","the","module","in","which","they","reside","(","as","this","causes","any","import","of","either","the","abstract","class","or","a","subclass","to","load","all","other","subclasses","and","the","abstract","class",")","."]
docstr: Returns the subclass that corresponds to the given `name`, along with the name of the
  method that was registered as a constructor for that `name`, if any.
  
  This method also allows `name` to be a fully-specified module name, instead of a name that
  was already added to the `Registry`.  In that case, you cannot use a separate function as
  a constructor (as you need to call `cls.register()` in order to tell us what separate
  function to use).
docstr_tok: ["Returns","the","subclass","that","corresponds","to","the","given","`","name","`",",","along","with","the","name","of","the","method","that","was","registered","as","a","constructor","for","that","`","name","`",",","if","any",".","This","method","also","allows","`","name","`","to","be","a","fully-specified","module","name",",","instead","of","a","name","that","was","already","added","to","the","`","Registry","`",".","In","that","case",",","you","can","not","use","a","separate","function","as","a","constructor","(","as","you","need","to","call","`","cls.register","(",")","`","in","order","to","tell","us","what","separate","function","to","use",")","."]
code: def resolve_class_name(
      cls: Type[_RegistrableT], name: str
  ) -> Tuple[Type[_RegistrableT], Optional[str]]:
      """
      Returns the subclass that corresponds to the given `name`, along with the name of the
      method that was registered as a constructor for that `name`, if any.
  
      This method also allows `name` to be a fully-specified module name, instead of a name that
      was already added to the `Registry`.  In that case, you cannot use a separate function as
      a constructor (as you need to call `cls.register()` in order to tell us what separate
      function to use).
      """
      if name in Registrable._registry[cls]:
          subclass, constructor = Registrable._registry[cls][name]
          return subclass, constructor
      elif "." in name:
          # This might be a fully qualified class name, so we'll try importing its "module"
          # and finding it there.
          parts = name.split(".")
          submodule = ".".join(parts[:-1])
          class_name = parts[-1]
  
          try:
              module = importlib.import_module(submodule)
          except ModuleNotFoundError:
              raise ConfigurationError(
                  f"tried to interpret {name} as a path to a class "
                  f"but unable to import module {submodule}"
              )
  
          try:
              subclass = getattr(module, class_name)
              constructor = None
              return subclass, constructor
          except AttributeError:
              raise ConfigurationError(
                  f"tried to interpret {name} as a path to a class "
                  f"but unable to find class {class_name} in {submodule}"
              )
  
      else:
          # is not a qualified class name
          available = cls.list_available()
          suggestion = _get_suggestion(name, available)
          raise ConfigurationError(
              (
                  f"'{name}' is not a registered name for '{cls.__name__}'"
                  + (
                      ". "
                      if not suggestion
                      else f", did you mean '{suggestion}'? "
                  )
              )
              + "If your registered class comes from custom code, you'll need to import "
              "the corresponding modules. If you're using AllenNLP from the command-line, "
              "this is done by using the '--include-package' flag, or by specifying your imports "
              "in a '.allennlp_plugins' file. "
              "Alternatively, you can specify your choices "
              """using fully-qualified paths, e.g. {"model": "my_module.models.MyModel"} """
              "in which case they will be automatically imported correctly."
          )
  
file_path: allennlp/allennlp/common/registrable.py
imports: import importlib
  import logging
  import inspect
  from collections import defaultdict
  from typing import Callable, ClassVar, DefaultDict, Dict, List, Optional, Tuple, Type, TypeVar, cast, Any
  from allennlp.common.checks import ConfigurationError
  from allennlp.common.from_params import FromParams
label_desc: Use image node_id 3 for calling the Registrable obj's underlying member method code with example usage: obj.resolve_class_name(cls, name) and returns: subclass,  constructor, subclass,  constructor