code: def _build_rows(
      baseline_states: Iterable["ExpState"],
      *,
      all_headers: Iterable[str],
      fill_value: Optional[str],
      sort_by: Optional[str] = None,
      sort_order: Optional[Literal["asc", "desc"]] = None,
      **kwargs,
  ) -> Iterator[Tuple["CellT", ...]]:
      for baseline in baseline_states:
          row: Dict[str, "CellT"] = {k: fill_value for k in all_headers}
          row["Experiment"] = ""
          if baseline.name:
              row["rev"] = baseline.name
          elif Git.is_sha(baseline.rev):
              row["rev"] = baseline.rev[:7]
          else:
              row["rev"] = baseline.rev
          row["typ"] = "baseline"
          row["parent"] = ""
          if baseline.data:
              row["Created"] = format_time(
                  baseline.data.timestamp,
                  fill_value=fill_value,
                  **kwargs,
              )
              row.update(
                  _data_cells(baseline, fill_value=fill_value, **kwargs)
              )
          yield tuple(row.values())
          if baseline.experiments:
              if sort_by:
                  metrics_names: Mapping[
                      str, Iterable[str]
                  ] = kwargs.get("metrics_names", {})
                  params_names: Mapping[
                      str, Iterable[str]
                  ] = kwargs.get("params_names", {})
                  sort_path, sort_name, sort_type = _sort_column(
                      sort_by, metrics_names, params_names
                  )
                  reverse = sort_order == "desc"
                  experiments = _sort_exp(
                      baseline.experiments,
                      sort_path,
                      sort_name,
                      sort_type,
                      reverse,
                  )
              else:
                  experiments = baseline.experiments
              for i, child in enumerate(experiments):
                  yield from _exp_range_rows(
                      child,
                      all_headers=all_headers,
                      fill_value=fill_value,
                      is_base=i == len(baseline.experiments) - 1,
                      **kwargs,
                  )
  
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 3 for calling a global function with example usage: _build_rows(baseline_states) without return types