<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def scandir(path, app=None):
    '''
    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
    '''
    exclude = app and app.config.get('exclude_fnc')
    if exclude:
        return (
            item
            for item in compat.scandir(path)
            if not exclude(item.path)
            )
    return compat.scandir(path)