code: def collect_yaml(paths: Sequence[str] = paths) -> list[dict]:
      """Collect configuration from yaml files
  
      This searches through a list of paths, expands to find all yaml or json
      files, and then parses each file.
      """
      # Find all paths
      file_paths = []
      for path in paths:
          if os.path.exists(path):
              if os.path.isdir(path):
                  try:
                      file_paths.extend(
                          sorted(
                              os.path.join(path, p)
                              for p in os.listdir(path)
                              if os.path.splitext(p)[1].lower()
                              in (".json", ".yaml", ".yml")
                          )
                      )
                  except OSError:
                      # Ignore permission errors
                      pass
              else:
                  file_paths.append(path)
  
      configs = []
  
      # Parse yaml files
      for path in file_paths:
          config = _load_config_file(path)
          if config is not None:
              configs.append(config)
  
      return configs
  
imports: from __future__ import annotations
  import ast
  import base64
  import builtins
  import json
  import os
  import site
  import sys
  import threading
  import warnings
  from collections.abc import Mapping, Sequence
  from typing import Any, Literal
  import yaml
  from dask.typing import no_default
label_desc: Use image node_id 6 for calling a global function with example usage: collect_yaml(paths) and returns: configs