code: def list_files(self, subdir, extension):
      dirpath = os.path.join(self.path, subdir)
      if not os.path.isdir(dirpath):
          return []
  
      res = []
      for filename in sorted(os.listdir(dirpath)):
          res.append(
              scripts.ScriptFile(
                  self.path, filename, os.path.join(dirpath, filename)
              )
          )
  
      res = [
          x
          for x in res
          if os.path.splitext(x.path)[1].lower() == extension
          and os.path.isfile(x.path)
      ]
  
      return res
  
imports: from __future__ import annotations
  import configparser
  import os
  import threading
  import re
  from modules import shared, errors, cache, scripts
  from modules.gitpython_hack import Repo
  from modules.paths_internal import extensions_dir, extensions_builtin_dir, script_path
label_desc: Use image node_id 6 for calling the Extension obj's underlying member method code with example usage: obj.list_files(subdir, extension) and returns: res, list