code: def _get_sheet_names(
      sheet_id: int | Sequence[int] | None,
      sheet_name: str | list[str] | tuple[str] | None,
      worksheets: list[dict[str, Any]],
  ) -> tuple[list[str], bool]:
      """Establish sheets to read; indicate if we are returning a dict frames."""
      if sheet_id is not None and sheet_name is not None:
          raise ValueError(
              f"cannot specify both `sheet_name` ({sheet_name!r}) and `sheet_id` ({sheet_id!r})"
          )
      sheet_names = []
      if sheet_id is None and sheet_name is None:
          sheet_names.append(worksheets[0]["name"])
          return_multi = False
      elif sheet_id == 0:
          sheet_names.extend(ws["name"] for ws in worksheets)
          return_multi = True
      else:
          return_multi = (
              (
                  isinstance(sheet_name, Sequence)
                  and not isinstance(sheet_name, str)
              )
              or isinstance(sheet_id, Sequence)
              or sheet_id == 0
          )
          if names := (
              (sheet_name,)
              if isinstance(sheet_name, str)
              else sheet_name or ()
          ):
              known_sheet_names = {ws["name"] for ws in worksheets}
              for name in names:
                  if name not in known_sheet_names:
                      raise ValueError(
                          f"no matching sheet found when `sheet_name` is {name!r}"
                      )
                  sheet_names.append(name)
          else:
              ids = (
                  (sheet_id,)
                  if isinstance(sheet_id, int)
                  else sheet_id or ()
              )
              sheet_names_by_idx = {
                  idx: ws["name"]
                  for idx, ws in enumerate(worksheets, start=1)
                  if (
                      sheet_id == 0
                      or ws["index"] in ids
                      or ws["name"] in names
                  )
              }
              for idx in ids:
                  if (name := sheet_names_by_idx.get(idx)) is None:  # type: ignore[assignment]
                      raise ValueError(
                          f"no matching sheet found when `sheet_id` is {idx}"
                      )
                  sheet_names.append(name)
      return sheet_names, return_multi
  
imports: from __future__ import annotations
  import re
  from io import StringIO
  from pathlib import Path
  from typing import TYPE_CHECKING, Any, BinaryIO, Callable, NoReturn, Sequence, overload
  import polars._reexport
  from polars import functions
  from polars.datatypes import Date, Datetime
  from polars.exceptions import NoDataError, ParameterCollisionError
  from polars.io.csv.functions import read_csv
  from polars.utils.various import normalize_filepath
label_desc: Use image node_id 16 for calling a global function with example usage: _get_sheet_names(sheet_id, sheet_name, worksheets) and returns: sheet_names,  return_multi