code: def find(root: Union[Path, str], dirs: bool = True) -> str:
      
      if isinstance(root, str):
          root = Path(root)
  
      results: List[Path] = []
      for dirpath, dirnames, filenames in os.walk(root):
          names = filenames
          if dirs:
              names += dirnames
          for name in names:
              results.append(Path(dirpath) / name)
      results.sort()
      return "\n".join(str(result.relative_to(root)) for result in results)
docs: A test helper simulating 'find'.
  
      Iterates over directories and filenames, given as relative paths to the
      root.