code: def listdir(path):
      
      try:
          cached_mtime, list = cache[path]
          del cache[path]
      except KeyError:
          cached_mtime, list = -1, []
      mtime = os.stat(path).st_mtime
      if mtime != cached_mtime:
          list = os.listdir(path)
          list.sort()
      cache[path] = mtime, list
      return list
docs: List directory contents, using cache.