code: def _collect_paths(
      repo: "Repo",
      targets: Iterable[str],
      recursive: bool = False,
  ) -> StrPaths:
      from dvc.fs.dvc import DVCFileSystem
  
      fs = DVCFileSystem(repo=repo)
      fs_paths = [fs.from_os_path(target) for target in targets]
  
      target_paths: StrPaths = []
      for fs_path in fs_paths:
          if recursive and fs.isdir(fs_path):
              target_paths.extend(fs.find(fs_path))
          target_paths.append(fs_path)
  
      return target_paths
  
imports: from typing import TYPE_CHECKING, Callable, Iterable, List, Optional, Tuple
  from dvc.log import logger
label_desc: Use image node_id 2 for calling a global function with example usage: _collect_paths(repo, targets, recursive) and returns: target_paths