code: def scantree(path: str) -> Generator:
      
      for entry in os.scandir(path):
          if entry.is_dir(follow_symlinks=False):
              yield from scantree(entry.path)
          else:
              if entry.name.endswith('.py'):
                  yield entry
docs: Recursively yield DirEntry objects for given directory.