code: def _get_by_type(nav, t: type[T]) -> list[T]:
      ret = []
      for item in nav:
          if isinstance(item, t):
              ret.append(item)
          if item.children:
              ret.extend(_get_by_type(item.children, t))
      return ret
  
imports: from __future__ import annotations
  import logging
  from typing import TYPE_CHECKING, Iterator, TypeVar
  from urllib.parse import urlsplit
  from mkdocs.exceptions import BuildError
  from mkdocs.structure import StructureItem
  from mkdocs.structure.pages import Page, _AbsoluteLinksValidationValue
  from mkdocs.utils import nest_paths
label_desc: Use image node_id 3 for calling a global function with example usage: _get_by_type(nav, t) and returns: ret