def checkcache(filename=None):
if filename is None:<EOL><INDENT>filenames = cache.keys()<EOL><DEDENT>else:<EOL><INDENT>if filename in cache:<EOL><INDENT>filenames = [filename]<EOL><DEDENT>else:<EOL><INDENT>return<EOL><DEDENT><DEDENT>for filename in filenames:<EOL><INDENT>size, mtime, lines, fullname = cache[filename]<EOL>if mtime is None:<EOL><INDENT>continue   <EOL><DEDENT>try:<EOL><INDENT>stat = os.stat(fullname)<EOL><DEDENT>except os.error:<EOL><INDENT>del cache[filename]<EOL>continue<EOL><DEDENT>if size != stat.st_size or mtime != stat.st_mtime:<EOL><INDENT>del cache[filename]<EOL><DEDENT><DEDENT>
Discard cache entries that are out of date.
    (This is not checked upon each call!)