code: def replace_components(root, component, base_class):
      """
      Recursively look at all fields in config to find where `component` would fit.
      This is used to change configs so that they don't use default values.
      Return the chain of field names, from child to parent.
      """
      for k, v in get_config_fields(root).items():
          default, _, options = v
          if options and component in options:
              return [k]
          else:
              v_comp_name = get_component_name(default)
              v_comp_obj = next(
                  iter(find_config_class(v_comp_name)), None
              )
              if v_comp_obj:
                  found = replace_components(
                      v_comp_obj, component, base_class
                  )
                  if found:
                      found.append(k)
                      return found
  
                  # Not found in options, try to match base classes
                  bases = get_subclasses(v_comp_obj)
                  bases.add(v_comp_obj)
                  if base_class & set(bases):
                      return [k]
  
file_path: pytext/pytext/utils/documentation.py
imports: from enum import Enum
  from inspect import getmembers, isclass, isfunction
  from sys import modules
  from typing import Union
  import torch
  from pytext.config.component import Component, get_component_name
  from pytext.config.pytext_config import ConfigBase
  from pytext.models.module import Module
label_desc: Use image node_id 6 for calling a global function with example usage: replace_components(root, component, base_class) and returns: list, found, list