code: def dirhash(self, path, **dirhash_opts):
          
          path = fs.path(path)
          last_modified = time.ctime(max(
              max(os.path.getmtime(os.path.join(root, file)) for file in files)
              for root,_,files in os.walk(path)))
  
          db = sqlite3.connect(self.path)
          c = db.cursor()
          c.execute("SELECT date, hash FROM dirhashcache WHERE path=?", (path,))
          cached = c.fetchone()
  
          if cached:
              cached_date, cached_hash = cached
              if cached_date == last_modified:
                  # cache hit
                  dirhash = cached_hash
              else:
                  # out of date cache
                  dirhash = checksumdir.dirhash(path, self.hash, **dirhash_opts)
                  c.execute("UPDATE dirhashcache SET date=?, hash=? WHERE path=?",
                            (last_modified, dirhash, path))
                  db.commit()
          else:
              # new entry
              dirhash = checksumdir.dirhash(path, self.hash, **dirhash_opts)
              c.execute("INSERT INTO dirhashcache VALUES (?,?,?)",
                        (path, last_modified, dirhash))
              db.commit()
  
          db.close()
          return dirhash
docs: Compute the hash of a directory.
  
          Arguments:
             path: Directory.
             **dirhash_opts: Additional options to checksumdir.dirhash().
  
          Returns:
              str: Checksum of directory.