def scandir(path, app=None):
exclude = app and app.config.get('<STR_LIT>')<EOL>if exclude:<EOL><INDENT>return (<EOL>item<EOL>for item in compat.scandir(path)<EOL>if not exclude(item.path)<EOL>)<EOL><DEDENT>return compat.scandir(path)<EOL>
Config-aware scandir. Currently, only aware of ``exclude_fnc``.

:param path: absolute path
:type path: str
:param app: flask application
:type app: flask.Flask or None
:returns: filtered scandir entries
:rtype: iterator