code: def _resolve_tools(
      tools: str | Sequence[Tool | str],
  ) -> tuple[list[Tool], dict[str, Tool]]:
      tool_objs: list[Tool] = []
      tool_map: dict[str, Tool] = {}
  
      if not isinstance(tools, str):
          temp_tool_str = ""
          for tool in tools:
              if isinstance(tool, Tool):
                  tool_objs.append(tool)
              elif isinstance(tool, str):
                  temp_tool_str += tool + ","
              else:
                  raise ValueError(
                      "tool should be a string or an instance of Tool class"
                  )
          tools = temp_tool_str
  
      for tool in re.split(r"\s*,\s*", tools.strip()):
          # re.split will return empty strings; ignore them.
          if tool == "":
              continue
  
          tool_obj = Tool.from_string(tool)
          tool_objs.append(tool_obj)
          tool_map[tool] = tool_obj
  
      return tool_objs, tool_map
  
file_path: bokeh/src/bokeh/plotting/_tools.py
imports: from __future__ import annotations
  import logging
  import itertools
  import re
  from dataclasses import dataclass
  from typing import TYPE_CHECKING, Any, Callable, Iterator, Literal, Sequence, Union, cast
  from ..models import HoverTool, Plot, Tool, Toolbar
  from ..models.tools import Drag, GestureTool, InspectTool, Scroll, Tap
  from ..util.warnings import warn
label_desc: Use image node_id 3 for calling a global function with example usage: _resolve_tools(tools) and returns: tool_objs,  tool_map