<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _collect_scopes(handlers, scopes, user, client):
 """ Get a set of all the authorized scopes according to the handlers. """

    results = set()

    data = {'user': user, 'client': client}

    def visitor(scope_name, func):
        claim_names = func(data)
        # If the claim_names is None, it means that the scope is not authorized.
        if claim_names is not None:
            results.add(scope_name)

    _visit_handlers(handlers, visitor, 'scope', scopes)

    return results