code: def tabulate(
      baseline_states: Iterable["ExpState"],
      fill_value: Optional[str] = "-",
      error_value: str = "!",
      **kwargs,
  ) -> Tuple["TabularData", Dict[str, Iterable[str]]]:
      """Return table data for experiments.
  
      Returns:
          Tuple of (table_data, data_headers)
      """
      from funcy import lconcat
      from funcy.seqs import flatten as flatten_list
  
      from dvc.compare import TabularData
  
      data_names = _collect_names(baseline_states)
      metrics_names = data_names.metrics
      params_names = data_names.params
      deps_names = data_names.sorted_deps
  
      headers = [
          "Experiment",
          "rev",
          "typ",
          "Created",
          "parent",
          "State",
          "Executor",
      ]
      names = {**metrics_names, **params_names}
      counter = Counter(
          flatten_list([list(a.keys()) for a in names.values()])
      )
      counter.update(headers)
      metrics_headers = _normalize_headers(metrics_names, counter)
      params_headers = _normalize_headers(params_names, counter)
  
      all_headers = lconcat(
          headers, metrics_headers, params_headers, deps_names
      )
      td = TabularData(all_headers, fill_value=fill_value)
      td.extend(
          _build_rows(
              baseline_states,
              all_headers=all_headers,
              metrics_headers=metrics_headers,
              params_headers=params_headers,
              metrics_names=metrics_names,
              params_names=params_names,
              deps_names=deps_names,
              fill_value=fill_value,
              error_value=error_value,
              **kwargs,
          )
      )
      data_headers: Dict[str, Iterable[str]] = {
          "metrics": metrics_headers,
          "params": params_headers,
          "deps": deps_names,
      }
      return td, data_headers
  
imports: from collections import Counter, defaultdict
  from datetime import date, datetime
  from typing import TYPE_CHECKING, Any, Dict, Iterable, Iterator, List, Literal, Mapping, NamedTuple, Optional, Set, Tuple, Union
  from dvc.exceptions import InvalidArgumentError
  from dvc.log import logger
  from dvc.scm import Git
  from dvc.ui import ui
  from dvc.utils.flatten import flatten
  from .collect import collect
label_desc: Use image node_id 2 for calling a global function with example usage: tabulate(baseline_states, fill_value, error_value) and returns: td,  data_headers