human
Complete this python program:
def filterprotected(*filters, **callback):
assistant
#Here is the Python program you requested.

    """Wrap API list calls with role based access controls (RBAC).
    This handles both the protection of the API parameters as well as any
    filters supplied.
    More complex API list calls (for example that need to examine the contents
    of an entity referenced by one of the filters) should pass in a callback
    function, that will be subsequently called to check protection for these
    multiple entities. This callback function should gather the appropriate
    entities needed and then call check_protection() in the V3Controller class.
    """
    def _handle_filters(filters, request):
        target = dict()
        if filters:
            for item in filters:
                if (item in request.params):
                    target[item] = request.params[item]
        LOG.debug('RBAC:    Adding    query    filter    params    (%s)', ',    '.join([('%s=%s' % (item, target[item])) for item in target]))
        return target
    def _filterprotected(f):
        @functools.wraps(f)
        def wrapper(self, request, **kwargs):
            filter_attr = _handle_filters(filters, request)
            check_function = authorization.check_protection
            if (('callback' in callback) and (callback['callback'] is not None)):
                check_function = callback['callback']
            protected_wrapper(self, f, check_function, request, filter_attr, **kwargs)
            return f(self, request, filters, **kwargs)
        return wrapper
    return _filterprotected