code: def get_ui(
      ui_type, on_ui_exit=None, available_ui_types=None, config=None
  ):
      """Create a `base_ui.BaseUI` subtype.
  
      This factory method attempts to fallback to other available ui_types on
      ImportError.
  
      Args:
        ui_type: (`str`) requested UI type. Currently supported:
          ( readline)
        on_ui_exit: (`Callable`) the callback to be called when the UI exits.
        available_ui_types: (`None` or `list` of `str`) Manually-set available
          ui_types.
        config: An instance of `cli_config.CLIConfig()` carrying user-facing
          configurations.
  
      Returns:
        A `base_ui.BaseUI` subtype object.
  
      Raises:
        ValueError: on invalid ui_type or on exhausting or fallback ui_types.
      """
      if available_ui_types is None:
          available_ui_types = copy.deepcopy(SUPPORTED_UI_TYPES)
  
      if ui_type and (ui_type not in available_ui_types):
          raise ValueError("Invalid ui_type: '%s'" % ui_type)
  
      try:
          # pylint: disable=g-import-not-at-top
          if ui_type == "readline":
              from tensorflow.python.debug.cli import readline_ui
  
              return readline_ui.ReadlineUI(
                  on_ui_exit=on_ui_exit, config=config
              )
          # pylint: enable=g-import-not-at-top
      except ImportError:
          available_ui_types.remove(ui_type)
          if not available_ui_types:
              raise ValueError("Exhausted all fallback ui_types.")
          return get_ui(
              available_ui_types[0],
              available_ui_types=available_ui_types,
          )
  
label_desc: Use image node_id 1 for calling a global function with example usage: get_ui(ui_type, on_ui_exit, available_ui_types, config) and returns: readline_ui, get_ui