Return a callable appropriate for __dir__().

    All values specified in **kwargs get passed directly to filtered_attrs().
    The 'additions' argument should be an iterable which is added to the final
    results.

def filtered_dir(module_name, *, additions={}, **kwargs):
    """Return a callable appropriate for __dir__().

    All values specified in **kwargs get passed directly to filtered_attrs().
    The 'additions' argument should be an iterable which is added to the final
    results.

    """
    module = importlib.import_module(module_name)

    def __dir__():
        attr_names = set(filtered_attrs(module, **kwargs))
        attr_names.update(additions)
        return sorted(attr_names)

    return __dir__