def parse_python_file(filepath):
with _AST_CACHE_LOCK:<EOL><INDENT>if filepath not in _AST_CACHE:<EOL><INDENT>source = read_file(filepath)<EOL>_AST_CACHE[filepath] = ast.parse(source, filename=filepath)<EOL><DEDENT><DEDENT>return _AST_CACHE[filepath]<EOL>
Retrieves the AST of the specified file.

This function performs simple caching so that the same file isn't read or
parsed more than once per process.

:param filepath: the file to parse
:type filepath: str
:returns: ast.AST